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?()
第1题:
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?()
第2题:
public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()
第3题:
public class foo { public static void main (String[]args) { String s; system.out.printIn (“s=” + s); } } What is the result?()
第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?()
第5题:
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()
第6题:
String foo = “blue”; Booleanbar = new Boolean [1]; if (bar[0]) { foo = “green”; } What is the result?()
第7题:
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?()
第8题:
An exception is thrown.
The code does no compile.
“Hello World.” Is printed to the terminal.
The program exits without printing anything.
第9题:
Foo has the value of “”
Foo has the value of null.
Foo has the value of “blue”
Foo has the value of “green”
An exception is thrown.
The code will not compile.
第10题:
An exception is thrown.
The program exists without printing anything.
An error at line 1 causes compilation to fail.
An error at line 6 causes the compilation to fail.
“Running” is printed and the program exits.
第11题:
Baz has the value of “”
Baz has the value of null
Baz has the value of “red”
Baz has the value of “blue”
Bax has the value of “green”
The program throws an exception.
第12题:
foofoofoofoofoo
foobarfoobarbar
foobarfoofoofoo
foobarfoobarfoo
barbarbarbarbar
foofoofoobarbar
foofoofoobarfoo
第13题:
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?()
第14题:
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?()
第15题:
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’)&&(i<2); foo(‘C’)){ i++ ; foo(‘D’); } } } What is the result?()
第16题:
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?()
第17题:
String foo = “blue”; Boolean[]bar = new Boolean [1]; if (bar[0]) { foo = “green”; } What is the result? ()
第18题:
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? ()
第19题:
Baz has the value of “”
Baz has the value of null
Baz has the value of “red”
Baz has the value of “blue”
Bax has the value of “green”
The program throws an exception.
第20题:
baz =
baz = null
baz = blue
Compilation fails.
An exception is thrown at runtime.
第21题:
Java Test 2222
Java Test 1 2 3 4
Java Test 4 2 4 2
Java Test 4 3 2 1
第22题:
The program runs and prints nothing.
The program runs and prints “Finally”
The code compiles, but an exception is thrown at runtime.
The code will not compile because the catch block is missing.
第23题:
An exception is thrown.
The code will not compile.
The program prints “null”
The program prints “blue”
The program prints “green”