import java.io.FileWriter;标签:IO,fw,处理,System,IOException,io,catch,FileWriter,异常 From: https://blog.51cto.com/u_10028442/5824708
import java.io.IOException;
public class IODemo2 {
public static void main(String[] args) {
FileWriter fw=null;
try {
fw = new FileWriter("G:\\io.txt");
fw.write("adasds");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.toString());
}
finally{
try {
if(fw!=null){ //防止未创建成功抛空指针异常
fw.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.toString());
}
}
}
}