网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
当执行下面代码时,会输出( )。 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.a
B.b
C.c
D.d
参考答案
更多 “ 当执行下面代码时,会输出( )。 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 ” 相关考题
考题
下列代码的编译或执行结果是______。public class MyVal{puhlic static void main(String args[]){MyVal m=new MyVal();m.aMethod();}public void aMethod(){boolean b[]=new Boolean[5];System.out.println(b[0]);}A) 1B) nullC) 0D) 编译错误A.B.C.D.
考题
已知如下代码: boolean m = true; if ( m = false ) System.out.println("False"); else System.out.println("True"); 执行结果是什么?()
A.FalseB.TrueC.编译时出错D.运行时出错
考题
public class Test{public static void main(String[]args){intx=5;boolean b1=true;boolean b2=false;if((x==4)!b2)System.out.print(l);System.out.print(2);if((b2=true)b1)System.out.print(3);}}What is the result?()A.2B.3C.12D.23E.123F.Compilation fails.G.An exceptional ist hrown at runtime.
考题
已知如下代码: 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
考题
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 My Val{ public static void main(String args[]){ My Val m=new My Val(); m. amethod(); } public void amethod(){ boolean b[]=new Boolean[5]; } } 程序编译或运行结果是A.1B.nullC.D.编译不能过
考题
下面程序段: 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
考题
下列代码的编译或执行结果是( )。 public class Myval{ public static void main(string args[]){ MyVal m=new MyVal; aMethod; } public void aMethod{ boolean b[]=new Boolean[5]; System.OUt.println(b[0]); } }A.1B.nullC.0D.编译错误
考题
下面程序段: 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
考题
下面均为Java关键字的一组是()A、boolean,byte,long,trueB、byte, long,true,gotoC、goto ,Boolean,byte,trueD、bool, long,true,auto
考题
下面均为java关键字的一组是()A、boolean ,byte,long,assertB、byte,long,true,gotoC、goto,boolean,byte,nullD、boolean,long,false,auto
考题
下面哪些语句是没有编译错误的()A、StringBuffer sb=“java”;B、inti=0x56;C、Boolean b=new Boolean(“java”);D、float f=1.0;
考题
public class Test { public static void main(String [] args) { int x =5; boolean b1 = true; boolean b2 = false; if((x==4) !b2) System.out.print(”l “); System.out.print(”2 “); if ((b2 = true) b1) System.out.print(”3 “); } } What is the result?() A、 2B、 3C、 1 2D、 2 3E、 1 2 3F、 Compilation fails.G、 Au exceptional is thrown at runtime.
考题
将有三个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.
考题
单选题int index = 1; boolean[] test = new Boolean[3]; 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.
考题
单选题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.
考题
单选题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; }
考题
单选题public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()A
TrueB
NottrueC
Anexceptionisthrownatruntime.D
Compilationfailsbecauseofanerroratline12.E
Compilationfailsbecauseofanerroratline19.
考题
单选题public class X { public static void main (Stringargs) { String s1 = new String (“true”); Boolean b1 = new Boolean (true); if (s2.equals(b1)) { System.out.printIn(“Equal”); } } } What is the result? ()A
The program runs and prints nothing.B
The program runs and prints “Equal”C
An error at line 5 causes compilation to fail.D
The program runs but aborts with an exception.
考题
单选题public class Test{ public static void main(String[]args){ intx=5; boolean b1=true; boolean b2=false; if((x==4)!b2) System.out.print("l"); System.out.print("2"); if((b2=true)b1) System.out.print("3"); } } What is the result?()A
2B
3C
12D
23E
123F
Compilation fails.G
An exceptional ist hrown at runtime.
考题
单选题public class X { public static void main (String[]args) { String s1 = new String (“true”); Boolean b1 = new Boolean (true); if (s2.equals(b1)) { System.out.printIn(“Equal”); } } } What is the result?()A
The program runs and prints nothing.B
The program runs and prints “Equal”C
An error at line 5 causes compilation to fail.D
The program runs but aborts with an exception.
考题
单选题下列代码的编译或执行结果是( )。
public class MyVal{
public static void main(String args[]){
MyVal m = new MyVal();
m.aMethod();
}
public void aMethod(){
boolean b[] = new Boolean[5];
System.out.println(b[0]);
}
}A
1B
nullC
0D
编译错误
热门标签
最新试卷