我的e盘下有一个a.txt的文件,在控制台显示文件中的内容
作者:互联网
package com.Work1;
import org.junit.Test;
import java.io.*;
/**
* @Author: 廾匸
* @Date: 2020/12/2 17:54
* @Description: 控制台打印
* @version: 1.01
*/
public class Print {
@Test
public void test01() throws IOException {
Reader reader = new FileReader("G:\\a.txt");
BufferedReader bufferedReader = new BufferedReader(reader);
String str = null;
while((str = bufferedReader.readLine()) != null){
System.out.println(str);
}
}
}
标签:盘下,null,显示文件,str,reader,Test,new,txt 来源: https://blog.csdn.net/rq12345688/article/details/110501938