import java.io.FileWriter;
import java.io.IOException;
public class FileWirterDemo1 {
/**
* @param args
*/
public static void main(String[] args) {
FileWriter fw =null;
try {
fw = new FileWriter("D:\\file.txt"); //file not fund exception
fw.write("123456"); //空指针异常
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
if(fw!=null){
fw.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}