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”

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”

相关考题:

public class Foo implements Runnable (  public void run (Thread t) {  system.out.printIn(“Running.”);  }  public static void main (String[] args)  {  new thread (new Foo()).start();  } )   What is the result?()      A、 An exception is thrown.B、 The program exists without printing anything.C、 An error at line 1 causes compilation to fail.D、 An error at line 2 causes the compilation to fail.E、 “Running” is printed and the program exits.

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 nullC、 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.

public class Foo {   public void main (String args) {   system.out.printIn(“Hello World.”);   }   }   What is the result? () A、 An exception is thrown.B、 The code does no compile.C、 “Hello World.” Is printed to the terminal.D、 The program exits without printing anything.

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、 foofoofoofoofooB、 foobarfoobarbarC、 foobarfoofoofooD、 foobarfoobarfooE、 barbarbarbarbarF、 foofoofoobarbarG、 foofoofoobarfoo

public class Test {   public static void main (Stringargs) {   String foo = args[1];   String bar = args;   String baz = args;   System.out.printIn(“baz = ” + baz);  }   }   And the output:  Baz = 2   Which command line invocation will produce the output?()A、 Java Test 2222B、 Java Test 1 2 3 4C、 Java Test 4 2 4 2D、 Java Test 4 3 2 1

public class Test {   public static void main (String args) {   class Foo {   public int i = 3;  }   Object o = (Object) new Foo();   Foo foo = (Foo)o;   System.out.printIn(foo. i);  }   }   What is the result?()  A、 Compilation will fail.B、 Compilation will succeed and the program will print “3”C、 Compilation will succeed but the program will throw a ClassCastException at line 6.D、 Compilation will succeed but the program will throw a ClassCastException at line 7.

public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()A、 The program runs and prints nothing.B、 The program runs and prints “Finally”C、 The code compiles, but an exception is thrown at runtime.D、 The code will not compile because the catch block is missing.

public class Test {  public static void main( String[] args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.println(“baz = “ + baz); }  }   And the command line invocation: java Test red green blue   What is the result?()  A、 baz =B、 baz = nullC、 baz = blueD、 Compilation fails.E、 An exception is thrown at runtime.

public class foo {  public static void main (String[]args) {  String s;  system.out.printIn (“s=” + s);  }  }   What is the result?()  A、 The code compiles and “s=” is printed.B、 The code compiles and “s=null” is printed.C、 The code does not compile because string s is not initialized.D、 The code does not compile because string s cannot be referenced.E、 The code compiles, but a NullPointerException is thrown when toString is called.

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 Test {  public static void main (String[]args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.printIn(“baz = ” + baz);  }  }  And the output:  Baz = 2  Which command line invocation will produce the output?()  A、 Java Test 2222B、 Java Test 1 2 3 4C、 Java Test 4 2 4 2D、 Java Test 4 3 2 1

public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()  A、 i = 3B、 Compilation fails.C、 A ClassCastException is thrown at line 6.D、 A ClassCastException is thrown at line 7.

public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()A、 FinallyB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.

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(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   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 nullC、 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.

1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()  A、 Compilation will fail.B、 Compilation will succeed and the program will print “3”C、 Compilation will succeed but the program will throw a ClassCastException at line 6.D、 Compilation will succeed but the program will throw a ClassCastException at line 7.

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

单选题public class Foo {   public void main (String args) {   system.out.printIn(“Hello World.”);   }   }   What is the result? ()A An exception is thrown.B The code does no compile.C “Hello World.” Is printed to the terminal.D The program exits without printing anything.

单选题public class Test {  public static void main( String[] args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.println(“baz = “ + baz); }  }   And the command line invocation: java Test red green blue   What is the result?()A baz =B baz = nullC baz = blueD Compilation fails.E An exception is thrown at runtime.

单选题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 Test {  public static void main (String[]args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.printIn(“baz = ” + baz);  }  }  And the output:  Baz = 2  Which command line invocation will produce the output?()A Java Test 2222B Java Test 1 2 3 4C Java Test 4 2 4 2D Java Test 4 3 2 1

单选题public class Foo implements Runnable (  public void run (Thread t) {   system.out.printIn(“Running.”);   }   public static void main (String args) {   new thread (new Foo()).start();   }   )   What is the result?()A An exception is thrown.B The program exists without printing anything.C An error at line 1 causes compilation to fail.D An error at line 6 causes the compilation to fail.E “Running” is printed and the program exits.

单选题public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()A The program runs and prints nothing.B The program runs and prints “Finally”C The code compiles, but an exception is thrown at runtime.D The code will not compile because the catch block is missing.

单选题public class test(   public static void main(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   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 nullC 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.

单选题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”

单选题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 foofoofoofoofooB foobarfoobarbarC foobarfoofoofooD foobarfoobarfooE barbarbarbarbarF foofoofoobarbarG foofoofoobarfoo