• 2021-04-14
    下面程序段的输出结果为( )。 public class Test { public static void main(String args[]) { booleana,b,C; a=(3<5): b=(a= =true); System.out.println("a="+a+"b="+b); c=(b= =false); System.out.println("b="+b+"c="+c); } } A.a=true b=false b=true c=true B.a=true b=false b=true c=false C.a=false b=true b=true c=false D.a=false b=false b=true c=false
  • 正确答案:CC。【解析】本题考查关系运算符<和==。题目中a=(3<5);比较3和5的大小,因为3<5,返回true给a;b=(a==true);判断a是否为真,因为a确实为真,返回true给b;c=(b==false);判断b是否为假,因为b不为假,返回false给e。最后结果a=true,b=true,b=true,e=false,选项C正确。

    内容

    • 0

      ‎下列程序输出结果有true的是‎ A: true = "true"false = "false"if false: print(false)elif true: print(true) B: true = "true"false = "false"if true: print(true)elif false: print(false) C: true = "true"false = "false"if False: print(false)elif True: print(true) D: true = "true"false = "false"if True: print(true)elif False: print(false)

    • 1

      ‍下面代码的输出结果是​‍a = 2​‍b = 2​‍c = 2.0​‍print(a == b, a is b, a is c)​‍​ A: True False False B: True False True C: True True False D: False False True

    • 2

      x<-c(TRUE,FALSE,FALSE),y<-c(TRUE,TRUE,FALSE)),运行x&&y这行代码是什么结果 () A: TRUE FALSE TRUE B: TRUE C: TRUE FALSE FALSE D: FALSE

    • 3

      尝试运行下面的代码会发生什么?( )public class Test { public static void main(String&#91;&#93; args) { boolean m = true; if (m = false) { System.out.println("true"); } else { System.out.println("false"); } }} A: 输出字符串”true” B: 输出字符串”false” C: 编译时错误 D: 运行时错误

    • 4

      分析下面程序,其正确的输出结果是()。 A: true,true B: true,false C: false,true D: false,false