测试Java Exception 的finally。
Q: Catch 阶段如果return,会不会走进Finally?
A: 会走进Finally
测试代码:
private static void testExceptionFinally() {
try{throw new Exception("test");
} catch (Exception e){
System.out.println("catch");
e.printStackTrace();
return;
} finally{
System.out.println("finally");
}
}