BufferedReader.readLine()读取文件
File file = new File("C:\\Users\\Administrator\\Desktop\\test.txt");
FileReader f = new FileReader(file);
BufferedReader bf = new BufferedReader(f);
String s ;
while ((s=bf.readLine())!=null) {
System.out.println(s);
}
不用while的判断只会输出一行。