标签:style blog io color ar java sp div on
例子一:
1 public class A { 2 public static void main(String[] args) { 3 System.out.print(tt()); 4 } 5 6 public static int tt() { 7 int b = 23; 8 try { 9 System.out.println("yes"); 10 return b += 88; 11 } catch (Exception e) { 12 System.out.println("error:" + e); 13 } finally { 14 if (b > 25) { 15 System.out.println("b>25:" + b); 16 } 17 System.out.println("finally"); 18 } 19 return b; 20 } 21 }
输出:
yes
b>25:111
finally
111
也就是说明finally语句在return语句执行完了以后才执行的.
更改部分代码:
^^^^^^^^^^
标签:style blog io color ar java sp div on
原文地址:http://www.cnblogs.com/DreamDrive/p/4093796.html