com*_*guy -3 java file-io
例如:
FileWriter saveFile = new FileWriter("text.txt");
此代码显示错误:
Unhandled exception type IOException
这是什么意思?
ami*_*mit 6
Java 检查了异常机制.
这意味着RuntimeException方法抛出的每个异常(不是)必须由内部方法处理,或者声明抛出它(在其声明中).
RuntimeException
在您的示例中,构造函数FileWriter是IOExceptionthrow,因此您应该通过try-catch块在方法内部处理它,或者声明方法的签名可能会抛出它.
FileWriter
IOException
归档时间:
11 年,5 月 前
查看次数:
77 次
最近记录: