标签:lock 没有 except block file public com hello ring
变量没有被定义
fw cannot be resolved
变量没有被初始化
正确代码
package com.itheima_01;
import java.io.FileWriter;
import java.io.IOException;
public class ExceptionDemo1 {
public static void main(String[] args) {
FileWriter fw=null;
try {
fw =new FileWriter("a.txt");
fw.write("hello");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
try {
fw.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
标签:lock 没有 except block file public com hello ring
原文地址:https://www.cnblogs.com/dianzan/p/9821289.html