62,635
社区成员




综合一下:执行t.aaa()是,函数执行return ++x; 就将值返回给y(==2),由于x是局部变量,最后执行finally的++x也不会影响y的值;如果x是全局变量的话,y的值还是2,但此时x 的值变成3(与y无关),故关键代码还是return ++x 造成的
If the try clause executes a return, the compiled code does the following: 1.Saves the return value (if any) in a local variable. 2.Executes a jsr to the code for the finally clause. 3.Upon return from the finally clause, returns the value saved in the local variable.