ArrayIndexOutOfBoundsException stack trace

Report a typo

Read this code carefully.

public class ExceptionDemo {
    public static void main(String[] args) {
        int[] demoArray = {0, 1, 2, 3, 4, 5};

        System.out.println(demoArray[10]);
    }
}

If you run it, the application will throw an error, with the first line displaying this message:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 6

What will this line be followed by?

Select one option from the list
___

Create a free account to access the full topic