标签:row close 循环 rgs demo static 释放 out system
public class BufferedReaderDemo { public static void main(String[] args) throws IOException { // 创建流对象 BufferedReader br = new BufferedReader(new FileReader("in.txt")); // 定义字符串,保存读取的一行文字 String line = null; // 循环读取,读取到最后返回null while ((line = br.readLine())!=null) { System.out.print(line); System.out.println("------"); } // 释放资源 br.close(); } }
标签:row close 循环 rgs demo static 释放 out system
原文地址:https://www.cnblogs.com/theworld/p/11650124.html