public int aaa(){
int x=1;
try{
return ++x;
}catch(Exception e){
}finally{
++x;
}
//System.out.println("**");
return x;
}
public static void main(String[] args) {
Test t= new Test();
int y=t.aaa();
System.out.println(y);
}
打印结果是
//2
考虑把最后的return x写到finally里面结果就不同了。是3. |
|