publicclassIfTest(publicstaticvoidmain(string[]args){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecutesbutdoesnotprintamessage.
publicclassIfTest(publicstaticvoidmain(string[]args){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?()
A.Theoutputis“Equal”
B.Theoutputin“NotEqual”
C.Anerroratline5causescompilationtofall.
D.Theprogramexecutesbutdoesnotprintamessage.
相关考题:
classFoo{publicstaticvoidmain(String[]args){intx=0;inty=4;for(intz=0;z〈3;z++,x++){if(x〉1++y〈10)y++;}System.out.println(y);}}结果是什么?() A.6B.7C.8D.10
现有: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
publicclassBoxer1{2.Integeri;3.intx;4.publicBoxer1(inty){5.x=i+y;6.System.out.println(x);7.}8.publicstaticvoidmain(String[]args){9.newBoxer1(newInteger(4));10.}11.}Whatistheresult?() A.Thevalue“4”isprintedatthecommandline.B.Compilationfailsbecauseofanerrorinline5.C.Compilationfailsbecauseofanerrorinline9.D.ANullPointerExceptionoccursatruntime.E.ANumberFormatExceptionoccursatruntime.F.AnIllegalStateExceptionoccursatruntime.
publicclassWhileFoo{publicstaticvoidmain(String[]args){intx=1,y=6;while(y--){x--;}system.out.printIn(x=”+xy=”+y);}}Whatistheresult?() A.Theoutputisx=6y=0B.Theoutputisx=7y=0C.Theoutputisx=6y=-1D.Theoutputisx=7y=-1E.Compilationwillfail.
publicclassX{publicstaticvoidmain(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.
publicclassTest{publicstaticvoidmain(String[]args){intx=0;assert(x>0):“assertionfailed”;System.out.println(“finished”);}}Whatistheresult?() A.finishedB.Compilationfails.C.AnAssertionErroristhrown.D.AnAssertionErroristhrownandfinishedisoutput.
publicclassIfTest(publicstaticvoidmain(stringargs){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecutesbutdoesnotprintamessage.
执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }A.1B.2C.3D.4
下列代码执行之后,输出的结果为______。 public class ex38 { public static void main(String[] args) { int x=12; int m=11; int y=13; int temp=x>y?x:y; temp=temp>m?temp:m; System.out.println (temp); } }A.1B.12C.13D.11