如果在catch子句中抛出异常,最终仍会运行

did*_*ido 2 java exception try-catch

考虑到下面的代码,如果catch子句中抛出异常,最终是否仍会运行?

try {
//code here throws exception
}
catch(Exception ex) {
//code catches above exception however code here also throws another exception
}
finally {
//does this code even run considering the exception thrown in the above catch clause??
}
Run Code Online (Sandbox Code Playgroud)

Aid*_*anc 7

是的,它确实.无论try/catch中发生什么,它都会运行(假设JVM由于某种原因没有关闭)