Array Index Out Of Bounds
What is the result of executing the following code segment?
public class ArrayError {
public static void main(String[] args) {
int[] values = {1, 2, 3};
System.out.println(values[3]);
}
}
A
No error, prints 0
B
NullPointerException
C
Compilation Error
D
ArrayIndexOutOfBoundsException
Question Leaderboard
Not enough data yet to show leaderboard.
