标签:close throws adf ams 工程 pre 控制台 buffered work
package homework;
import java.io.*;
public class IO {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
String ste="12345abcdef@#%&*软件工程";
File f1=new File("C:\\Users\\WIN10\\Desktop\\data.txt");
f1.createNewFile();
//System.out.println("名称"+f1.getName());
FileWriter fy=new FileWriter(f1);
BufferedWriter fw=new BufferedWriter(fy);
fw.write(ste);
fw.close();
fy.close();
}
}
package homework;
import java.io.*;
public class readFile {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String ss;
File f1=new File("C:\Users\WIN10\Desktop\data.txt");
FileReader fw=new FileReader(f1);
BufferedReader fy=new BufferedReader(fw);
while((ss=fy.readLine())!=null){
System.out.println(ss);
}
fy.close();
fw.close();
}
}
标签:close throws adf ams 工程 pre 控制台 buffered work
原文地址:https://www.cnblogs.com/xiezhixin/p/11155884.html