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

题目
单选题
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 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
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

public class Foo {  public void main( String[] args ) {  System.out.println( “Hello” + args[0] );  }  }   What is the result if this code is executed with the command line?()

  • A、 Hello
  • B、 Hello Foo
  • C、 Hello world
  • D、 Compilation fails.
  • E、 The code does not run.

正确答案:E

第2题:

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 2222
  • B、 Java Test 1 2 3 4
  • C、 Java Test 4 2 4 2
  • D、 Java Test 4 3 2 1

正确答案:C

第3题:

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

第4题:

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 2222
  • B、 Java Test 1 2 3 4
  • C、 Java Test 4 2 4 2
  • D、 Java Test 4 3 2 1

正确答案:C

第5题:

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.

正确答案:B

第6题:

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

第7题:

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

第8题:

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

第9题:

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 = null
  • C、 baz = blue
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:E

第10题:

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 = 3
  • B、 Compilation fails.
  • C、 A ClassCastException is thrown at line 6.
  • D、 A ClassCastException is thrown at line 7.

正确答案:A

更多相关问题