【发布时间】:2021-07-31 04:34:18
【问题描述】:
try {
Image image = new Image("MyComputer/Documents/Photos/estambul.jpg");
try {
//...
image.print();
throw new NullPointerException();
} finally {
System.out.println("FINALLY");
image.close();
throw new IOException();
}
} catch (IOException ex){
System.out.println("IO_EXCEPTION");
System.out.println(ex.getMessage());
}
System.out.println("THREAD IS CONTINUE");
这里没有抛出 NullPointerException。但是,没有 catch 块可以捕获它。看起来 IOException 正在压缩 NullPointerException。你的评论是什么?没看懂。
【问题讨论】:
标签: java exception try-catch try-catch-finally