/** * Created by HASEE on 2017/4/24. */ public class FinallyDemo2 { public static void main(String[] args) { System.out.println(test()); } private static int test() { int i=10; try { System.out.println("執行try:1"); //return i+=20; i=i/0; } catch (Exception e){ i+=15; System.out.println("執行catch:2"); } finally { System.out.println("執行finally:3"); if (i>15){ System.out.println("i>15:4"); } i+=50; } return i; } }