Java I/O流之BufferedReader实现读取文件

public class TestBufferedReader2 {
    public static void main(String[] args) throws Exception{
        File file = new File("e:"+File.separator+"print.txt");
        BufferedReader buf = new BufferedReader(new FileReader(file));
        String str = null;
        while((str=buf.readLine())!=null){
            System.out.println(str);
        }
        buf.close();
    }
}

你可能感兴趣的:(JAVA,Jave,SE基础)