RandTest.java

import java.io.*;

/**
Test reading and writing a random access file.
*/
public class RandTest {
    public static void main(String[] argv)
    {
        try {
            File file = new File("bimbo.txt");
            RandomAccessFile f = 
                new RandomAccessFile(file,"rw");
            f.writeBytes("This is a great test.\n");
            f.writeBytes("So is this!\n");
            f.seek(10);
            f.writeBytes("silly");
            f.close();
            }
        catch(Exception e) {
            System.out.println(e);
            }
    }
}