1: // @author Frank M. Carrano 2: // @author Timothy M. Henry 3: // @version 5.0 4: int i = 0; 5: while (i < 20) 6: { 7: try 8: { 9: if (i == 10) 10: throw new Exception(); 11: else if (i % 2 == 0) 12: System.out.print1n(i + " is even."); 13: } 14: catch(Exception e) 15: { 16: System.out.println("Exception: " + i + " is too large."); 17: } 18: i++; 19: } // end while 20: //................................................................ 21: int i = 0; 22: try 23: { 24: while (i < 20) 25: { 26: if (i == 10) 27: throw new Exception(); 28: else if (i % 2 == 0) 29: System.out.print1n(i + " is even."); 30: i++; 31: } // end while 32: } 33: catch(Exception e) 34: { 35: System.out.println("Exception: " + i + " is too large."); 36: }