public int test(){//返回 10
int i = 0;// 1
try{
i = 10; // 2
return i; // 3 // 6
}catch(Exception e){
e.printStackTrace();
}finally{
System.out.println("xxx"); // 4
i += 10;//5
}
return i;
该结果返回10
可以单步调试一下:
执行顺序如上所标数
public int test(){//返回 10
int i = 0;// 1
try{
i = 10; // 2
return i; // 3 // 6
}catch(Exception e){
e.printStackTrace();
}finally{
System.out.println("xxx"); // 4
i += 10;//5
}
return i;
该结果返回10
可以单步调试一下:
执行顺序如上所标数