the array has length 6 and the last index is 5. the index 7 is out of bounds.
public static void main(String[] args) { int array[] = {1,2,3,4,5,6}; System.out.println(array[7]); }
output:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 6