InterviewSolution
| 1. |
What Is Randomaccessfile? |
|
Answer» It is a special CLASS from java.io package which is NEITHER a input stream nor a output stream (because it can do both). It is DIRECTLY a subclass of Object class. Generally, a stream does only one purpose of EITHER reading or writing; but RandomAccessFile can do both reading from a file and writing to a file. All the methods of DATAINPUTSTREAM and DataOutStream exist in RandomAccessFile. It is a special class from java.io package which is neither a input stream nor a output stream (because it can do both). It is directly a subclass of Object class. Generally, a stream does only one purpose of either reading or writing; but RandomAccessFile can do both reading from a file and writing to a file. All the methods of DataInputStream and DataOutStream exist in RandomAccessFile. |
|