package cn.zxj.com;
import java.io.*;
/*
要求用缓冲流:java写一个程序,实现从文件中读出文件内容,并将其打印在屏幕当中,并标注上行号
*/
class Test {
public static void main(String[] args){
File file = new File("count.txt");
BufferedReader bufferedReader = null;
try{
bufferedReader = new BufferedReader(new FileReader(file));
String line = null;
int i = 0;
while((line = bufferedReader.readLine())!=null){
i++;
System.out.println(i+" "+ line);
}
}catch (Exception e){
}finally {
try{
bufferedReader.close();
}catch (Exception e){
}
}
}
}