public class Test02 {
public static void main(String[] args) {
//构建文件对象
FileReader reader = null;、
try {
reader = new FileReader("d:\\a.txt");
char c1 = (char)reader.read();
System.out.println(c1);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if(reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Java——读取文本
最新推荐文章于 2022-12-29 15:08:13 发布