RandomAccessFile class allows a file to be read from or written to at random locations. Constructor takes String arguments "r"/"rw" for read only/read-write access to file. The method seek(int) can be used to place the pointer where the read and write can be done.
Exercise: Write a program that demonstrates RandomAccessFile
Current file length is 800 First number is 0 Second number is 1 Tenth number is 9 Modifying the eleventh number to 555 Current file length is 800 Eleventh number is 555
Download Code: Random Access File
No comments:
Post a Comment