网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? ()
A

 Foo has the value of “”

B

 Foo has the value of null.

C

 Foo has the value of “blue”

D

 Foo has the value of “green”

E

 An exception is thrown.

F

 The code will not compile.


参考答案

参考解析
解析: 暂无解析
更多 “单选题String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? ()A  Foo has the value of “”B  Foo has the value of null.C  Foo has the value of “blue”D  Foo has the value of “green”E  An exception is thrown.F  The code will not compile.” 相关考题
考题 下列代码的编译或执行结果是______。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.

考题 publicclassTest{publicstaticvoidmain(String[]args){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?() A.Anexceptionisthrown.B.Thecodewillnotcompile.C.Theprogramprints“null”D.Theprogramprints“blue”E.Theprogramprints“green”

考题 Stringfoo=blue”;Boolean[]bar=newBoolean[1];if(bar[0]){foo=green”;}Whatistheresult?() A.Foohasthevalueof“”B.Foohasthevalueofnull.C.Foohasthevalueof“blue”D.Foohasthevalueof“green”E.Anexceptionisthrown.F.Thecodewillnotcompile.

考题 Given:Which code, inserted at line 15, allows the class Sprite to compile?() A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }

考题 阅读下面程序 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.编译不能过

考题 下列代码的编译或执行结果是( )。 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.编译错误

考题 public class Test {   public static void main (String args) {  string foo = “blue”;  string bar = foo;   foo = “green”;   System.out.printIn(bar);   }   }   What is the result?()  A、 An exception is thrown.B、 The code will not compile.C、 The program prints “null”D、 The program prints “blue”E、 The program prints “green”

考题 class Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()      A、==B、equalsC、equals ==D、无结果输出

考题 public class Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()  A、 ABDCBDCBB、 ABCDABCDC、 Compilation fails.D、 An exception is thrown at runtime.

考题 Which statements concerning the relationships between the following classes are true?()   class Foo {  int num;   Baz comp = new Baz();   }   class Bar {  boolean flag;   }   class Baz extends Foo {   Bar thing = new Bar();   double limit;   }  A、A Bar is a Baz.B、A Foo has a Bar.C、A Baz is a Foo.D、A Foo is a Baz.E、A Baz has a Bar.

考题 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.

考题 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.

考题 Given:  8.int index = 1:  9.Boolean [] test = new boolcan [3];  10.boolcan 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.

考题 String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? () A、 Foo has the value of “”B、 Foo has the value of null.C、 Foo has the value of “blue”D、 Foo has the value of “green”E、 An exception is thrown.F、 The code will not compile.

考题 String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()  A、 Foo has the value of “”B、 Foo has the value of null.C、 Foo has the value of “blue”D、 Foo has the value of “green”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.

考题 多选题Which statements concerning the relationships between the following classes are true?()   class Foo {  int num;   Baz comp = new Baz();   }   class Bar {  boolean flag;   }   class Baz extends Foo {   Bar thing = new Bar();   double limit;   }AA Bar is a Baz.BA Foo has a Bar.CA Baz is a Foo.DA Foo is a Baz.EA Baz has a Bar.

考题 单选题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.

考题 单选题String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? ()A  Foo has the value of “”B  Foo has the value of null.C  Foo has the value of “blue”D  Foo has the value of “green”E  An exception is thrown.F  The code will not compile.

考题 单选题String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()A  Foo has the value of “”B  Foo has the value of null.C  Foo has the value of “blue”D  Foo has the value of “green”E  An exception is thrown.F  The code will not compile.

考题 单选题public class Test {  public static void main (String [] args)  {  string foo = “blue”;  string bar = foo;  foo = “green”;  System.out.printIn(bar);  }  }   What is the result?()A  An exception is thrown.B  The code will not compile.C  The program prints “null”D  The program prints “blue”E  The program prints “green”

考题 单选题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 Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()A ==B equalsC equals ==D 无结果输出

考题 单选题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 Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()A  ABDCBDCBB  ABCDABCDC  Compilation fails.D  An exception is thrown 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 编译错误