- package IO;
- import java.io. * ;
- public class resdContent {
- public static void main(String[] args) throws Exception {
- /**
- * 读取文件内容
- */
- try {
- BufferedReader read = new BufferedReader(new FileReader("C:/hehe.txt")); // 要保证文件夹下有这个文件
- String str;
- while ((str = read.readLine()) != null) {
- System.out.println(str);
- }
- } catch(FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- }
输出结果
你是我的小苹果
怎么爱你都不嫌多
红红的小脸温暖我的心窝
来源: http://www.bubuko.com/infodetail-2514194.html