publicvoidfoo(booleana,booleanb){if(a){System.out.println(A”);}elseif(ab){System.out.println(AB”);}else{17.if(!b){System.out.println(notB”);}else{System.out.println(ELSE”);}}}Whatiscorrect?()A.Ifaistrueandbistruethentheoutputis“AB”.B.Ifaistrueandbisfalsethentheoutputis“notB”.C.Ifaisfalseandbistruethentheoutputis“ELSE”.D.Ifaisfalseandbisfalsethentheoutputis“ELSE”.

publicvoidfoo(booleana,booleanb){if(a){System.out.println(A”);}elseif(a&&b){System.out.println(A&&B”);}else{17.if(!b){System.out.println(notB”);}else{System.out.println(ELSE”);}}}Whatiscorrect?()

A.Ifaistrueandbistruethentheoutputis“A&&B”.

B.Ifaistrueandbisfalsethentheoutputis“notB”.

C.Ifaisfalseandbistruethentheoutputis“ELSE”.

D.Ifaisfalseandbisfalsethentheoutputis“ELSE”.


相关考题:

下列代码中if(xO){System.out.println(first);}elseif(x-3){System.out.println(second);)else{System.out.println(third);)要求打印字符串为“second”时,X的取值范围是( )。A.x-3B.x>0C.x>-3D.x

运行下面程序后,正确的输出结粜是( )。 public class Sun { public static void main(String args[]) { int x=6; if(x>6) System.out.printin("x>6"); else if(x<8) System.out.println("X<8"); else if(x==6) System.out.println("x=6"); } }A.x<8x=6B.x<8C.x=6D.x<8或x=6

运行下面程序后,正确的输出结果是( )。public class Sun{public static void main(String args[ ]){int x=6;if(x>6)System.out.println("x>6");elseif(x<8)System.out.println("x<8");elseif(x==6)System.out.println("x=6");}}A.x<8x=6B.x<8C.x=6D.x<8或x=6

下面哪几段代码不会出现编译错误() A、inti=0;if(i){System.out.println(“Hi”);}B、booleanb=true;booleanb2=true;if(b==b2){System.out.println(“Sotrue”);}C、inti=1;intj=2;if(i==1||j==2)System.out.println(“OK”);D、inti=1;intj=2;if(i==1

程序:classTestApp{publicstaticvoidmain(String[]args){intx=6;if(xl)System.out.println(xl);elseif(x5)System.out.println(x5);elseif(x10)System.out.println(xSystem.out.println(x29);elseSystem.out.println(以上都不是”);}}上述程序运行后的结果是哪项?()A.x5B.xlC.x10D.x29

Giventhefollowingcode:if(x0){System.out.println(first);}elseif(x-3){System.out.println(second);}else{System.out.println(third);}Whichrangeofxvaluewouldprintthestringsecond?()A.x0B.x-3C.x=-3D.x=0x-3

booleanbool=true;if(bool=false){System.out.println(“a”);}elseif(bool){System.out.println(“c”);}elseif(!bool){System.out.println(“c”);}else{System.out.println(“d”);}Whatistheresult?() A.aB.bC.cD.dE.Compilationfails.

当执行下面代码时,会输出( )。 Boolean b1 = new Boolean(true); Boolean b2 = new Boolean(true); if (b1 == b2) if (bi.equals(b2)) System. out.printin ("a"); else System. out. println ("b"); else if (bi.equals(b2)) System. out.println ("c"); else System. out.printIn("d");A.aB.bC.cD.d

执行下面的程序段后,B的值为多少? int x = 35; char z = 'A'; boolean B; B = ((x<15)(z<'z')); System.out.println(B);