- FileWriter fw=null;
- try{
-
- fw=new FileWriter("aaa.txt");
- fw.write("aaaa");
- //fw.flush(); //注销后照样能写入,这是因为后面close会自动执行这句吗?
- }
- catch(IOException e)
- {
- System.out.println("第一个catch:"+e.toString());
- }
- finally{
-
- try{
- if(fw!=null)
- fw.close();
- }
- catch(IOException e)
- {
- System.out.println("第二个catch:"+e.toString());
- }
- }
复制代码
|
|