1 package test4; 2 3 public class AfterTest { print()4 public void print() { System.out.println("test4.AfterTest"); } 5 test1()6 public int test1() { return m1(10) + m1(-10); } 7 m1(int i)8 public int m1(int i) { 9 if (i > 0) 10 i = i + 10; 11 else 12 return -i; 13 14 i = i + 100; 15 return i + 1; 16 } 17 test2()18 public int test2() throws Exception { return m2(1); } 19 m2(int i)20 public int m2(int i) throws Exception { 21 if (i > 10) 22 throw new Exception(); 23 else if (i > 0) 24 i = i + 10; 25 else 26 return -i; 27 28 i = i + 100; 29 return i + 1; 30 } 31 test3()32 public int test3() throws Exception { return m3(-10); } 33 m3(int i)34 public int m3(int i) throws Exception { 35 if (i > 10) 36 throw new Exception(); 37 else if (i > 0) 38 i = i + 10; 39 else 40 return -i; 41 42 i = i + 100; 43 throw new Exception(); 44 } 45 test4()46 public int test4() throws Exception { 47 try { 48 return m4(-10); 49 } 50 catch (Exception e) { 51 return 100; 52 } 53 } 54 m4(int i)55 public int m4(int i) throws Exception { 56 if (i > 0) 57 i = i + 10; 58 59 i = i + 100; 60 throw new Exception(); 61 } 62 test11()63 public int test11() { return mm1(10) + mm1(-10); } 64 mm1(int i)65 public int mm1(int i) { 66 if (i > 0) 67 i = i + 10; 68 else 69 return -i; 70 71 i = i + 100; 72 return i + 1; 73 } 74 test22()75 public int test22() throws Exception { return mm2(1); } 76 mm2(int i)77 public int mm2(int i) throws Exception { 78 if (i > 10) 79 throw new Exception(); 80 else if (i > 0) 81 i = i + 10; 82 else 83 return -i; 84 85 i = i + 100; 86 return i + 1; 87 } 88 test33()89 public int test33() throws Exception { return mm3(-10); } 90 mm3(int i)91 public int mm3(int i) throws Exception { 92 if (i > 10) 93 throw new Exception(); 94 else if (i > 0) 95 i = i + 10; 96 else 97 return -i; 98 99 i = i + 100; 100 throw new Exception(); 101 } 102 test44()103 public int test44() throws Exception { 104 try { 105 return mm4(-10); 106 } 107 catch (Exception e) { 108 return 100; 109 } 110 } 111 mm4(int i)112 public int mm4(int i) throws Exception { 113 if (i > 0) 114 i = i + 10; 115 116 i = i + 100; 117 throw new Exception(); 118 } 119 } 120