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.

题目
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.a

B.b

C.c

D.d

E.Compilationfails.


相似考题
更多“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?() ”相关问题
  • 第1题:

    Giventhefollowingcode:if(x>0){System.out.println("first");}elseif(x>-3){System.out.println("second");}else{System.out.println("third");}Whichrangeofxvaluewouldprintthestring"second"?()

    A.x>0

    B.x>-3

    C.x<=-3

    D.x<=0&x>-3


    参考答案:D

    x>0时打印"first",x>-3&&x<=0时打印"second",x<=-3时打印"third"。这个题目没有什么难的,只要理解if语句的语法就可以了。

  • 第2题:

    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”.


    参考答案:C

  • 第3题:

    C#中的数值0表示bool类型的false,数值1表示bool类型的true。


    ×

  • 第4题:

    try{if((newObject))(.equals((newObject()))){System.out.println(equal”);}else{System.out.println(notequal”);}}catch(Exceptione){System.out.println(exception”);}Whatistheresult?()

    A.equal

    B.notequal

    C.exception

    D.Compilationfails.


    参考答案:D

  • 第5题:

    给出下列代码片段: if(x>0){System.out.println("first");} else if(x>-3){System.out.println("second");} else{System.out.println("third");} 当x处于( )范围时打印字符串"second"。

    A.x>0

    B.x>-3

    C.-3<x<=0

    D.x<=-3


    正确答案:C