Shows reading a file
import java.io.*;
public class TestFile
{
public static void main(String args[])
{
try
{
RandomAccessFile file = new RandomAccessFile("test1.txt", "rw");
file.seek(0);
String d = "test";
while (d!=null)
{
d= file.readLine();
System.out.println("the string read at: " +file.getFilePointer()+ " is: " +d);
}
//displayList(ab);
file.close();
}
catch(Exception e)
{
System.err.println("Exception caught: " +e);
}
}
}
Pradyut
http://pradyut.tk
http://spaces.msn.com/members/oop-edge/
http://groups-beta.google.com/group/oop_programming
No comments:
Post a Comment