0
1
4
Compilation fails.
An exception is thrown at runtime.
第1题:
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()
第2题:
11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?()
第3题:
System.out.println(Math.sqrt(-4D)); What is the result?()
第4题:
public class Test { public static void main(String [] args) { System.out.println(args.length > 4 && args[4].equals(“-d”)); } } If the program is invoked using the command line: java Test One Two Three –d What is the result?()
第5题:
11. String test = “Test A. Test B. Test C.”; 12. // insert code here 13. String[] result = test.split(regex); Which regular expression inserted at line 12 will correctly split test into “Test A,” “Test B,” and “Test C”?()
第6题:
f[0] = 0
f[0] = 0.0
Compilation fails.
An exception is thrown at runtime.
第7题:
String regex = “”;
String regex = “ “;
String regex = “.*“.
String regex = “//s”
String regex = “//.//s*”;
String regex = “//w[ /.] +“;
第8题:
abc
null
abcdef
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第9题:
An exception is thrown at runtime.
1
4
Compilation fails.
0
第10题:
0
1
4
Compilation fails.
第11题:
–2
NaN
Infinity
Compilation fails.
An exception is thrown at runtime.
第12题:
NULL
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第13题:
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?()
第14题:
public class Test { private static int[] x; public static void main(String[] args) { System.out.println(x[0]); } } What is the result?()
第15题:
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
第16题:
11. public static void test(String str) { 12. if(str == null | str.lellgth() == 0) { 13. System.out.println(”String is empty”); 14. } else { 15. System.out.println(”String is not empty”); 16. } 17. } And the invocation: 31. test(llull); What is the result?()
第17题:
Given: 11.String test = "This is a test"; 12.String[] tokens = test.split("/s"); 13.System.out.println(tokens.length); What is the result?()
第18题:
0
null
Compilation fails.
A NullPointerException is thrown at runtime.
An ArrayIndexOutOfBoundsException is thrown at runtime.
第19题:
true
false
Compilation fails.
An exception is thrown at runtime.
第20题:
baz =
baz = null
baz = blue
Compilation fails.
An exception is thrown at runtime.
第21题:
Au exception is thrown at runtime.
“String is empty” is printed to output.
Compilation fails because of au error in line 12.
“String is not empty” is printed to output.
第22题:
null
zero
some
Compilation fails.
An exception is thrown at runtime.
第23题:
0
1
4
Compilation fails.
An exception is thrown at runtime.
第24题:
a b c
1 2 3
a1b2c3
a1 b2 c3
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.