/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author STUDENT */ public class ArrayOutOfBounds { /** * @param args the command line arguments */ public static void main(String[] args) { int value = 5; String colorNames[]= {"black", "blue", "cyan", "darkGray", "gray", "green", "lightGray","magenta", "orange", "pink", "red", "white", "yellow"}; try{ for (int current=1;current<=15; current++) System.out.println("colorNames[] = " +colorNames[current]); }catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index Out Of Bounds"); System.out.println("Error: " +e); }catch(Exception e){ System.out.println("Error: " +e); } } }