1 package test1; 2 3 class GetThrow1 extends Exception { 4 5 /** default serialVersionUID */ 6 private static final long serialVersionUID = 1L; 7 } 8 9 class GetThrow2 extends Exception { 10 11 /** default serialVersionUID */ 12 private static final long serialVersionUID = 1L; 13 } 14 15 public class GetThrowables { 16 int k = 0; 17 m1()18 public void m1() throws GetThrow1, GetThrow2 { 19 if (k < 0) 20 throw new GetThrow1(); 21 else if (k == 1) 22 throw new GetThrow2(); 23 24 k = 1; 25 } 26 run()27 public int run() throws GetThrow2 { 28 int i = 0; 29 try { 30 try { 31 m1(); 32 } 33 catch (GetThrow1 e) { 34 i = 1; 35 throw e; 36 } 37 finally { 38 i += 3; 39 } 40 } 41 catch (GetThrow1 e2) { 42 ++i; 43 } 44 45 return i; 46 } 47 } 48