String foo = “blue”;    Booleanbar = new Boolean [1];    if 

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

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Stringfoo=blue”;Booleanbar=newBoolean[1];if(bar[0]){foo=green”;}Whatistheresult?()

A.Foohasthevalueof“”

B.Foohasthevalueofnull.

C.Foohasthevalueof“blue”

D.Foohasthevalueof“green”

E.Anexceptionisthrown.

F.Thecodewillnotcompile.


参考答案:F

第2题:

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”

正确答案:D

第3题:

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”


参考答案:D

第4题:

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.

正确答案:A

第5题:

int index = 1;   String test = new String;   String foo = test[index];  What is the result?()

  • A、  Foo has the value “”
  • B、 Foo has the value null
  • C、 An exception is thrown
  • D、 The code will not compile

正确答案:B

第6题:

public class test(  public static void main(string[]args){  string foo = args [1];  string foo = args [2];  string foo = args [3];  }  )  And command line invocation: Java Test red green blue   What is the result?()  

  • A、 Baz has the value of “”
  • B、 Baz has the value of null
  • C、 Baz has the value of “red”
  • D、 Baz has the value of “blue”
  • E、 Bax has the value of “green”
  • F、 The program throws an exception.

正确答案:F

第7题:

public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?() 

  • A、 foofoofoofoofoo
  • B、 foobarfoobarbar
  • C、 foobarfoofoofoo
  • D、 foobarfoobarfoo
  • E、 barbarbarbarbar
  • F、 foofoofoobarbar
  • G、 foofoofoobarfoo

正确答案:D

第8题:

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.


参考答案:F

第9题:

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.

正确答案:C,E

第10题:

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.

正确答案:D

更多相关问题