/** * @author Leah Zagreus * * WARNING! This code has a BUG! * * This demonstrates an ArrayIndexOutOfBoundsException. */ public class SimpleDebug { public static void main(String[] args) { final int MAX_LENGTH = 10; int[] intArray = new int[MAX_LENGTH]; int sum = 0; for (int i = 0; i <= intArray.length; i++) { intArray[i] = i; sum += intArray[i]; } System.out.println(sum); } }