标签:style blog class code java c
try catch finally 语句中 如果try中有返回语句,如果在fianlly代码块中有对这个值修改的话,并不影响其放回值
public class Test { public static void main(String[] string){ System.out.println(test()); } public static int test(){ int i = 0; try { i ++; return i++; } catch (Exception e) { // TODO: handle exception }finally{ System.out.println("finally"); i++; System.out.println("i:"+i); } return 6; } }
try 返回前执行fianlly,布布扣,bubuko.com
标签:style blog class code java c
原文地址:http://www.cnblogs.com/mynona/p/3728893.html