题目内容

给出发下代码,请问该程序的运行结果是什么?class Example{public static void main(String [] args){int [] a={1,2,3,4,5};System.out.println(a[3]);}}

A. 1
B. 2
C. 3
D. 4

查看答案
更多问题

给出以下代码,请问该程序的运行结果是什么?class Example{public static void main(String [] args){int index=1;int foo[]=new int[3];int bar=foo[index];int baz=bar+index;System.out.println(baz);}}

A. 打印输出:0
B. 打印输出:1
C. 打印输出:2
D. 运行期有异常抛出
E. 代码编译失败答案B

给出以下代码,请问该程序的运行结果是什么?public class Example{public static void main(String [] args){boolean[]b=new boolean[2];double[]d=new double[2];System.out.print(b[0]);System.out.println(d[1]);}}

A. true0.0
B. true0
C. false0.0
D. false0

给出以下代码,请问该程序的运行结果是什么?public class Example{public static void main(String [] args){Objet[]o=new Objet[2];byte[]b=new byte[2];System.out.print(o[0]);System.out.println(b[1]);}}

A. 0
B. o0
C. 一个NullPointerException异常被抛出。
D. null0

给出以下代码,请问采取命令行方式java Example I like tests运行该程序,结果是什么?class Example{public static void main( ){System.out.println(args[l]);}}

A. 打印输出MyProg
B. 打印输出I
C. 打印输出Iike
D. 打印输出3
E. 打印输出4
F. 打印输出null

答案查题题库