例子一:
public class A { public static void main(String[] args) { System.out.print(tt()); } public static int tt() { int b = 23; try { System.out.println("yes"); return b += 88; } catch (Exception e) { System.out.println("error:" + e); } finally { if (b > 25) { System.out.println("b>25:" + b); } System.out.println("finally"); } return b; } }
输出:
yes
b>25:111
finally
111
也就是说明finally语句在return语句执行完了以后才执行的.
更改部分代码:
^^^^^^^^^^