finally 和 return语句执行的先后顺序
private int beforereturn(){
log.info("beforereturn run");
return 1;
}
private int testfinally(){
try{
int a=1;
} catch (Exception e){
log.info("catch exception");
} finally {
log.info("finally run");
}
return beforereturn();
}
输出为
finally run
beforereturn run