import java.io.*;
public class RandomFile {
public static void main(String args[])throws IOException
{
System.out.println("Reading Content in Read Write Mode");
RandomAccessFile Ra=new RandomAccessFile("Ex1.txt","rw");
Ra.seek(Ra.length());
System.out.println("Writing Content In File : Ex.txt");
String srt="Use For Java Program..";
Ra.write(srt.getBytes());
Ra.seek(0);
System.out.println("Reading Content Of File : Ex.txt \nContent :");
while((srt=Ra.readLine())!=null)
System.out.print(srt);
Ra.close();
}
}
public class RandomFile {
public static void main(String args[])throws IOException
{
System.out.println("Reading Content in Read Write Mode");
RandomAccessFile Ra=new RandomAccessFile("Ex1.txt","rw");
Ra.seek(Ra.length());
System.out.println("Writing Content In File : Ex.txt");
String srt="Use For Java Program..";
Ra.write(srt.getBytes());
Ra.seek(0);
System.out.println("Reading Content Of File : Ex.txt \nContent :");
while((srt=Ra.readLine())!=null)
System.out.print(srt);
Ra.close();
}
}
No comments:
Post a Comment