by Dinesh Thakur Category: Stream

 

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

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article