网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?()
A
a
B
b
C
c
D
d
E
Compilation fails.
参考答案
参考解析
解析:
First of all, the second println statement should print the character ‘b’ instead of ‘c’. Also, the answer is not E. but C. Indeed, the following line is perfectly legal: if ‘(bool = false)’. The bool variable will simply take the value of false and the IF statement will be evaluated to false. Therefore, the correct answer is C.
更多 “单选题boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?()A aB bC cD dE Compilation fails.” 相关考题
考题
已知如下代码: boolean m=true; if(m==false) System.out.prinfln("False"); else System.out.println("True");A.假B.真C.NoneD.An error will occur when running
考题
执行完下列代码段之后: bool x=true, y=false, z=false; x=xy‖z; y=x‖yz; z=!(x!=y)‖(y-z); 则x=false, y=false, Z=( )。A.trueB.falseC.不确定D.异常
考题
已知如下代码: boolean m = true; if ( m = false ) System.out.println("False"); else System.out.println("True"); 执行结果是什么?()
A.FalseB.TrueC.编译时出错D.运行时出错
考题
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 m=true; if (m==false) System.out.println("False"); else System.out.println("True"); 执行结果是( )。A.假B.TreeC.NoneD.An error will occur when running
考题
3下面程序段的输出结果为( )。 mblic class Test public static void main(String args[]) { boolean a,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=falseB.a=true b=false b=true c=trueC.a=true b=true b=true c=falseD.a=false b=false b=true c=false
考题
boolean a=false;boolean b=true;boolean c=(ab)(!b);boolean result=(ab)(!b); boolean result=(ab)(!b); 执行完后,正确的结果是( )。A.c=false;result=falseB.c=true,result=trueC.c=true;result=falseD.c=false;result=true
考题
下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,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=falseB.a=true b=false b=true c=trueC.a=true b=true b=true c=falseD.a=false b=false b=true c=false
考题
下面程序段: boolean a=false; boolean b=true; boolean c=(a||b)(b); boolean result=(a|b)(b); 执行完后,正确的结果是A.c=false;result=falseB.c=true,result=trueC.c=true;result=falseD.c=false;result=true
考题
写出执行完下列代码段之后指定变量的值:bool x=true ,y=false,z=false;x=xy||z;y=x||yz;z=!(x!=y)||(y==z);则x=false,y=【 】,z=【 】。
考题
下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,b,c; a=(35); b=(a==true); System.out.println(”a=”+a+”b=+b) ; c=(b==false); System.out.printhln(”b=”+b+”c=”+c) ; } }A.a=true b=false b=true c=falseB.a=true b=false b=true c=trueC.a=true b=true b=tree c=falseD.a=false b=false b=tree c=false
考题
下面均为Java关键字的一组是()A、boolean,byte,long,trueB、byte, long,true,gotoC、goto ,Boolean,byte,trueD、bool, long,true,auto
考题
下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,b,c; a=(3<5); b=(a==true); System.out.printin( "a="+a+"b="+b) ; c-(b==false); System.out.println(b="+b+"e="+c) ; } }A.a=true b=false b=true c=falseB.a=true b=false b=true c=trueC.a=true b=true b=true c=falseD.a=false b=false b=true c=false
考题
下面程序的结果为______。include void main() { int 3=1,b=2; bool c=1; if(a>b)||c
下面程序的结果为______。include<iostream.h>void main(){int 3=1,b=2;bool c=1;if(a>b)||c)cout<<“true”<<endl;elsecout<<“false”<<endl;}
考题
public void foo( boolean a, boolean b ){ if( a ) { System.out.println( “A” ); } else if ( a b ) { System.out.println( “AB” ); } else { 17. if ( !b ) { System.out.println( “notB” ); } else { System.out.println( “ELSE” ); } } } What is correct?() A、 If a is true and b is true then the output is “AB”.B、 If a is true and b is false then the output is “notB”.C、 If a is false and b is true then the output is “ELSE”.D、 If a is false and b is false then the output is “ELSE”.
考题
在public HttpSession getSession(boolean bool)的方法定义中,当bool为false时表明()A、直接返回会话对象B、当服务器已经创建了会话对象就返回该对象,否则返回nullC、直接返回nullD、当服务器已经创建了会话对象就返回该对象,否则新建一个会话对象并返回
考题
在C#中下列表达式不正确的是()。A、double a,double b=2,int c=3,a=b+cB、short a,byte b=2,byte c=3,a=b+cC、string a,string b=”1” string c=”2” a=b+cD、bool a,bool b=true,bool c=false a=b==c
考题
boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?() A、 aB、 bC、 cD、 dE、 Compilation fails.
考题
假设变量bool_x是一个布尔型(逻辑型)的变量,则下面正确的赋值语句是()A、bool_x="False"B、bool_x=.FalsE.C、bool_x=#False#D、bool_x=False
考题
单选题public void foo( boolean a, boolean b ){ if( a ) { System.out.println( “A” ); } else if ( a b ) { System.out.println( “AB” ); } else { 17. if ( !b ) { System.out.println( “notB” ); } else { System.out.println( “ELSE” ); } } } What is correct?()A
If a is true and b is true then the output is “AB”.B
If a is true and b is false then the output is “notB”.C
If a is false and b is true then the output is “ELSE”.D
If a is false and b is false then the output is “ELSE”.
考题
单选题在C#中下列表达式不正确的是()。A
double a,double b=2,int c=3,a=b+cB
short a,byte b=2,byte c=3,a=b+cC
string a,string b=”1” string c=”2” a=b+cD
bool a,bool b=true,bool c=false a=b==c
考题
单选题在public HttpSession getSession(boolean bool)的方法定义中,当bool为false时表明()A
直接返回会话对象B
当服务器已经创建了会话对象就返回该对象,否则返回nullC
直接返回nullD
当服务器已经创建了会话对象就返回该对象,否则新建一个会话对象并返回
热门标签
最新试卷