unhandled exception type Exception是什么意思?

2025-02-25 22:18:04
推荐回答(1个)
回答1:

请问是否是编译期出的问题,不是catch的问题这个错误是指:你有一个方法会抛出异常,但是你没有捕捉。程序改成如下就好了: public class Example8_4 {
public static void main(String[] args) {
try {
method();
} catch (Exception e) {
e.printStackTrace();
}
}

static void method()throws Exception {
try {
System.out.println("try:performed");
} finally {
System.out.println("finally:always performed");
}
}
}