现有:classTop{staticintX=l;publicTop(){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=l;}publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果是什么?() A.2B.3C.4D.编译失败
现有:classTop{staticintX=l;publicTop(){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=l;}publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果是什么?()
A.2
B.3
C.4
D.编译失败
相关考题:
classTestMain{staticintx=2;static{x=4;}publicstaticvoidmain(String...args){inty=x+1;System.out.println(y);}}和命令行:javaTestMain结果为:() A.3B.5C.编译失败D.运行时异常被抛出
importjava.util.*;classBanana3{publicstaticvoidmain(String[]args){intx=2;Banana3b=newBanana3();b.go(x);}static{x+=x;}voidgo(intx){++x;System.out.println(x);}}结果为:() A.2B.3C.5D.编译失败
classWhileTests{publicstaticvoidmain(String[]args){intx=5;while(++x〈3){--x;}System.out.println(x=+x);}}结果是什么?() A.x=2B.x=5C.x=6D.编译失败
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.运行时异常被抛出
现有: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
现有:classWhileTests{publicstaticvoidmain(String[]args){intX=5;while(++x4){--x;}System.out.println(x=+x);}}结果是什么?() A.X=6B.X=5C.X=2D.编译失败
现有:classTop{staticintx=l;publicTop(inty){x*=3;}}classMiddleextendsTop{publicMiddle(){x+=1;)publicstaticvoidmain(String[]args){Middlem=newMiddle();System.out.println(x);}}结果为:() A.1B.2C.3D.编译失败
执行如下语句之后,输出的结果是______。 public class ex24 { public static void main(String[] args) { int x=5,y=3; x+=X-- *--y; System.out.println{x); } }A.0B.1C.trueD.false