网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
boolean类型变量值只能是true或false()?
参考答案和解析
正确
更多 “boolean类型变量值只能是true或false()?” 相关考题
考题
已知如下代码: 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
考题
以上程序段运行的结果是:______. Dim a(-1 To 5) As Boolean Dim flag As Boolean flag = False Dim i As Integer Dim j As Integer Do Until flag = True For i = -1 To 5 j=j+1 if a(i)= False Then a(i)= True Exit For End If If i = 5 Then flag = True End If Next Loop Print jA.20B.7C.35D.8
考题
( 12 )下列布尔变量定义中,正确并且规范的是A )BOOLEAN canceled = false;B)boolean canceled = false;C)boolean CANCELED = false;D)boolean canceled = FALSE;
考题
已知如下代码: boolean m = true; if ( m = false ) System.out.println("False"); else System.out.println("True"); 执行结果是什么?()
A.FalseB.TrueC.编译时出错D.运行时出错
考题
已知如下代码: 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
考题
下列布尔变量定义中,正确并且规范的是A.BOOLEAN canceled=false;B.boolean canceled=false;C.boolean CANCELED=false;D.boolean canceled=FALSE;
考题
下面程序段的输出结果为 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
考题
已知如下代码: boolean m=tree; if(m==false) System.out.println("False"); else System.out.pfintln("True"); 执行结果是( )。A.FalseB.TrueC.无结果D.运行时出错
考题
下面程序段: boolean a=false; boolean b=true; boolean c=(aB) (!B) ; boolean result=(aB) (!B) ; 执行完后,正确的结果是( )。A.c=false;result=falseB.c=true,result=trueC.c=tree;result=falseD.c=false;result=trae
考题
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”.
考题
下面均为java关键字的一组是()A、boolean ,byte,long,assertB、byte,long,true,gotoC、goto,boolean,byte,nullD、boolean,long,false,auto
考题
将有三个boolean值的数组初始化为true的是()A、boolean[]b=newboolean[3]B、"boolean[]b={true,true,true}"C、"boolean[3]b={true,true,true}"D、"boolean[]b=newboolean[3];b={true,true,true}"
考题
Which determines if “prefs” is a directory and exists on the file system?() A、 Boolean exists=Directory.exists (“prefs”);B、 Boolean exists=(new File(“prefs”)).isDir();C、 Boolean exists=(new Directory(“prefs”)).exists();D、 Boolean exists=(new File(“prefs”)).isDirectory();E、 Boolean exists=true; Try{ Directory d = new Directory(“prefs”); } catch (FileNotFoundException e) { exists = false; }
考题
int index = 1; boolean test = new Boolean; boolean foo= test [index]; What is the result?()A、 Foo has the value of 0.B、 Foo has the value of null.C、 Foo has the value of true.D、 Foo has the value of false.E、 An exception is thrown.F、 The code will not compile.
考题
class Test4 { public static void main(String [] args) { boolean x = true; boolean y = false; short z = 42; if((z++ = = 42) (y = true)) z++; if((x = false) || (++z = = 45)) z++; System.out.println("z = " + z); } } 结果为:() A、z = 42B、z = 44C、z = 45D、z = 46
考题
单选题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”.
考题
单选题Which determines if “prefs” is a directory and exists on the file system?()A
Boolean exists=Directory.exists (“prefs”);B
Boolean exists=(new File(“prefs”)).isDir();C
Boolean exists=(new Directory(“prefs”)).exists();D
Boolean exists=(new File(“prefs”)).isDirectory();E
Boolean exists=true; Try{ Directory d = new Directory(“prefs”); } catch (FileNotFoundException e) { exists = false; }
考题
单选题现有: class Test2 f public static void main (String [] args) { boolean X= true; boolean y=false; short Z=20; if((x==true) & (y=true)) z++; if((y==true) || (++z==22)) z++; System. out .println( "z="+z); } 结果是什么?()A
Z=21B
Z=22C
Z=23D
Z= 24
考题
单选题现有: class Test4 { public static void main (String [] args) { boolean X=true; boolean y=false; short Z=42; if((z++==42) && (y=true))z++; if((x=false) || (++z==45)) z++; System. out.println(¨z=”+z); } } 结果为:()A
Z=42B
z=44C
Z= 45D
z= 46
考题
判断题boolean数据类型的数据只有true和false两个值。()A
对B
错
热门标签
最新试卷