import java.io.*;
public class FileReadTest
{
public static void main(String[] args)
{
FileReadTest t = new FileReadTest();
t.readMyFile();
}
void readMyFile()
{
String temp = null;
int count = 0;
try
{
FileReader fr = new FileReader("mydata.txt");
BufferedReader br = new BufferedReader(fr);
temp = new String();
while((temp = br.readLine()) != null)
{
count++;
System.out.println(count + ":" + temp);
}
br.close();
fr.close();
}
catch(IOException e)
{
System.out.println("OH,got an IOException error!");
e.printStackTrace();
}
}
}
posted on 2007-05-28 00:32
jadmin 阅读(42)
评论(0) 编辑 收藏