package com.itheima;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
//从文本中读取在控制台显示
public class ExamTest25 {
public static void main(String[] args) {
// 封装数据源
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("Test1.java"));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(new String(line));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
|
|