Analyze the following code:
public class Test {
public static void main(String[] args) {
int[] x = new int[5];
int i;
for (i = 0; i < x.length; i++)
x[i] = i;
System.out.println(x[i]);
}
}
(1分)
A.
The program displays 0 1 2 3 4.
B.
The program displays 4.
C.
The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundsException.
D.
The program has a compile error because i is not defined in the last statement in the main method.
C



