IO流—— 常用的类
作者:互联网
FileReader
String filepath = "D:\\啊哈哈哈7931\\story.txt";
FileReader fileReader=null;
int data=0;
try {
fileReader = new FileReader(filepath);
while ((data=fileReader.read())!=-1){
System.out.print((char)data);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if(fileReader!=null){
try {
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
标签:常用,filepath,fileReader,printStackTrace,IO,FileReader,null,data 来源: https://www.cnblogs.com/ahhh7931/p/16150591.html