网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有:classTestMain{staticintx=2;static{x=4;}staticpublicvoidmain(String[]args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:()
A.3
B.5
C.编译失败
D.运行时异常被抛出
参考答案
更多 “ 现有:classTestMain{staticintx=2;static{x=4;}staticpublicvoidmain(String[]args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:() A.3B.5C.编译失败D.运行时异常被抛出 ” 相关考题
考题
classTestMain{staticintx=2;static{x=4;}publicstaticvoidmain(String...args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:()
A.3B.5C.编译失败D.运行时异常被抛出
考题
LessTest{publicstaticvoidmain(String[]args){for(intx=0;x7;++x){inty=2;x=++y;}System.out.println(y=”+y);}}结果为:()
A.y=5B.y=6C.y=7D.y=8E.编译失败F.运行时异常被抛出
考题
classTop{staticintx=1;publicTop(inty){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=1;}publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果为:()
A.1B.2C.3D.编译失败
考题
现有:classTestMain{staticintx=2;static{x=4;}publicstaticvoidmain(String...args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:()
A.3B.5C.编译失败D.运行时异常被抛出
考题
classTestMain{staticintx=2;static{x=4;}staticpublicvoidmain(String[]args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:()
A.3B.5C.编译失败D.运行时异常被抛出
考题
现有:classTop{staticintX=l;publicTop(){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=l;}publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果是什么?()
A.2B.3C.4D.编译失败
考题
现有:classBanana2fstaticintX=2;publicstaticvoidmain(String[]args){intX=2;Banana2b=newBanana2();b.go(x);}static{x+=x;}voidgo(intx){++x;System.out.println(x);}结果为:()
A.7B.5C.3D.2
考题
现有:classFoo{publicstaticvoidmain(String[]args){intx=O;inty=4;for(intz=0;z3;Z++;X++){if(x1++y10)y++;}System.out.println(y);}}结果是什么?()
A.7B.8C.10D.12
考题
现有:classTop{staticintx=l;publicTop(inty){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=1;)publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果为:()
A.1B.2C.3D.编译失败
热门标签
最新试卷