【单选题】yze 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]); } }
A.
The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundception.
B.
The program displays 4.
C.
The program has a compile error because i is not defined in the last statement in the main method.
【单选题】运行程序,结果是什么? class A{ int i; A(int i){ this.i=i*2; } } class B extends A{ public static void main(String args[]){ B b=new B(2); } B(int i){ System.out.println(i); } }
【单选题】分析以下代码: 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]); } }