Sequential access files are leftovers from the days of magnetic tape and other naturally sequential medium. Random access files, on the other hand, permit non- sequential, or random, access to the contents of a file. Random access files are useful for many different applications. One specific example of a good use of random access files are zip files.
Zip files contain many other files and are compressed to conserve space.
With a random access file, you only read the directory and the file that you need. The RandomAccessFile class in the java.io package implements a random access file. Unlike the input and output streams in java.io, RandomAccessFile is used for both reading and writing files. You create the RandomAccessFile with different arguments depending on whether you intend to read or write. This is similar to the way files work on Unix.