try 返回前执行fianlly
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; } }