publicclassTest{publicstaticvoidmain(String[]args){intx=5;booleanb1=true;booleanb2=false;if((x==4)!b2)System.out.print(”l);System.out.print(”2);if((b2=true)b1)System.out.print(”3);}}Whatistheresult?()A.2B.3C.12D.23E.123F.Compilationfails.G.Auexceptionalisthrownatruntime.
publicclassTest{publicstaticvoidmain(String[]args){intx=5;booleanb1=true;booleanb2=false;if((x==4)&&!b2)System.out.print(”l);System.out.print(”2);if((b2=true)&&b1)System.out.print(”3);}}Whatistheresult?()
A.2
B.3
C.12
D.23
E.123
F.Compilationfails.
G.Auexceptionalisthrownatruntime.
相关考题:
下面程序执行后,输出的结果是( )。 public class Test { public static void main (String[] )args) { boolean m=true; if(m==false) System.out.println("假"); else if(m====true) System.out.println("真"); else System.out.println ("错误"); } }A.真B.假C.错误D.编译出错
classIfs{publicstaticvoidmain(String[]args){booleanstate=false;inti=1;if((++i1)(state=true))i++;System.out.println(i);}}结果是() A.5B.编译失败C.运行时异常被抛出D.3E.4
public class Test{public static void main(String[]args){intx=5;boolean b1=true;boolean b2=false;if((x==4)!b2)System.out.print(l);System.out.print(2);if((b2=true)b1)System.out.print(3);}}What is the result?()A.2B.3C.12D.23E.123F.Compilation fails.G.An exceptional ist hrown at runtime.
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.
publicclassAlpha1{publicstaticvoidmain(String[]args){booleanflag;inti=0;do{flag=false;System.out.println(i++);flag=i10;continue;}while((flag)?true:false);}}Whatistheresult?() A.000000000B.0123456789C.Compilationfails.D.Thecoderunswithnooutput.E.Thecodeentersaninfiniteloop.F.Anexceptionisthrownatruntime.
执行下列程序段之后,变量b的值为( )。 public class Test { public static void main (String[] args) { int i = 12; int j = 24; boolean b1 = true; booleanb=(j%i==0)(! b1) || (j/i! =2); System. out. println (B); } }A.trueB.falseC.0D.1
阅读下面的程序public class Test {public static void main(String[] args) {for(int x = 0 ; x A.跳出循环,无输出B.0121C.01D.0123
执行下列程序段之后,变量b的值为______。 public class Test9 { public static void main(String[] args) { int i=12; int j=24; boolean b1=true; boolean b=(j%i== 0)(!b1) ||(j/i!=2); System.out.println(b); } }A.trueB.假C.1D.0