/** * This one does everything right. The tr-catch is tight and messaging is specific. **/ public class Crash1 { static int[] a = { 10, 20, 30, 40, 50 }; public static void main(String[] args) { for (int i = 0; i <= 10; i++) { try { System.out.println(a[i]); } catch (ArrayIndexOutOfBoundsException aeoe) { System.err.println(aeoe.toString() + "\n Quitting!!!"); System.exit(0); } } System.out.println("Done printing the array!"); } }