java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 6

www.la‮u‬tturi.com
java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 6

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
Created Time:2017-10-01 16:24:31  Author:lautturi