/* From Java: A Beginner's Guide (3rd Edition) by Herbert Schildt. */ public class ExcDemo1 { public static void main (String [] args) { int nums[] = new int[4]; try { System.out.println ("Before exception is generated"); // Attempt to index past bounds of array. nums[7]= 10; System.out.println ("This message will not appear"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Index out of bounds"); } System.out.println("After catch"); } }