【单选题】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]); } }
A.
The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundsException.
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.
【单选题】阅读代码,判断输出结果是() public class MyCall{ public static void main(String[] args){ int[] number = new int[5]; for(int i= 0;i<3;i++){ number[i]=i; } for(int i=0;i
【单选题】public class Alpha{ private static Character() ids; public static void main( String[] args){ ids = new Character[args.length]; for (int i=0; i ids[i] = new Character( args[i] ); System.out.print(...
A.
Compilation fails.
B.
The code runs with no output.
C.
An exception is thrown at runtime.
D.
The code runs, outputing a concatenated list of the arguments passed to the program.
【单选题】分析以下代码: 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]); } }