给出以下代码,请问采用命令行方式java Example Metallica Justice For All运行该程序,结果是什么?class Example{public static void main( ){System.out.println(args[4]);}}
A. 打印输出All
B. 打印输出For
C. 打印输出Justice
D. 没有输出
E. 运行期错误
查看答案
给出以下代码,请问该程序的运行结果是什么?public class Example{static String s1;static String s2;public static void main(String args[]){s2=s1+s2;System.out.println(s2);}}
A. 代码编译失败
B. 运行期错误,抛出NullPointerException异常
C. 打印输出nullnull
D. 代码编译成功,打印输出内容为空白行
给出以下代码,请问该程序的运行结果是什么?public class Example{private int i=giveMeJ();private int j=10;private int giveMeJ(){return j;}public static void main(String args[]){System.out.println((new Example()).i);}}
A. 第8行代码编译错误
B. 第2行代码编译错误
C. 打印输出0
D. 打印输出10
给出以下代码,请问该程序的运行结果是什么?public class Example{private int j=10;private int i=giveMeJ();private int giveMeJ(){return j;}public static void main(String args[]){System.out.println((new Example()).i);}}
A. 第8行代码编译错误
B. 第2行代码编译错误
C. 打印输出0
D. 打印输出10
给出以下代码,请问该程序的运行结果是什么?public class Example{private int i=j;private int j=10;public static void main(String [] args){System.out.println((new Example()).i);}}
A. 第5行代码编译错误
B. 第2行代码编译错误
C. 打印输出0
D. 打印输出10