public static void main(String[] args) {
FileWriter fw = null;
try {
fw = new FileWriter("K:\\demo.txt");
fw.write("abcdef");
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.toString());
}
finally{
try {if(fw!=null)
fw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.toString());
}
}
}
会异常里面 ,有空指针异常, 是为什么呢? |