by Dinesh Thakur

 

import java.lang.System;

import java.io.RandomAccessFile;
import java.io.IOException;
public class RandomFileHandling
{
       public static void main(String args[])throws IOException
      {
           RandomAccessFile fp = new RandomAccessFile("ecomputernotes.bat","rw");
           fp.writeBoolean(true);
           fp.writeInt(50);
           fp.writeChar('r');
           fp.writeDouble(1234.56);
           fp.seek(5);
           System.out.println(fp.readChar());                       
           System.out.println(fp.readDouble());                   
           fp.seek(0);
           System.out.println(fp.readBoolean());                  
           System.out.println(fp.readInt());                        
           fp.close();
      }
                                                                                     
}

Random File Handling