本帖最后由 wyl530274554 于 2012-7-2 21:27 编辑
给你的FileReader加个包装
BufferedReader,它里面有个readLine()方法,一下读一行
代码参考:
import java.io.*;
public class BufferedReaderDemo {
public static void main(String[] args) throws IOException {
FileReader fr = new FileReader("G:\\Copy.txt");
BufferedReader br = new BufferedReader(fr);
String s = null;
while((s=br.readLine()) != null) {
System.out.println(s);
}
br.close();
}
}
|