Java RandomAccessFile class26 Mar 2025 | 2 min read This class is used for reading and writing to random access file. A random access file behaves like a large array of bytes. There is a cursor implied to the array called file pointer, by moving the cursor we do the read write operations. If end-of-file is reached before the desired number of byte has been read than EOFException is thrown. It is a type of IOException. Constructor
Method
ExampleThe myFile.TXT contains text "This class is used for reading and writing to random access file." after running the program it will contains This class is used for reading I love my country and my peoplele. Next TopicHow to Create a Zip File in Java |
We request you to subscribe our newsletter for upcoming updates.