An exception is thrown at runtime.
1
4
Compilation fails.
0
第1题:
public static void main(String[] args) { String str = “null‟; if (str == null) { System.out.println(”null”); } else (str.length() == 0) { System.out.println(”zero”); } else { System.out.println(”some”); } } What is the result?()
第2题:
Given: 11.String test = "a1b2c3"; 12.String[] tokens = test.split("//d"); 13.for(String s: tokens) System.out.print(s + " "); What is the result?()
第3题:
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()
第4题:
11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?()
第5题:
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?()
第6题:
Given: 11.String test = "This is a test"; 12.String[] tokens = test.split("/s"); 13.System.out.println(tokens.length); What is the result?()
第7题:
String regex = “”;
String regex = “ “;
String regex = “.*“.
String regex = “//s”
String regex = “//.//s*”;
String regex = “//w[ /.] +“;
第8题:
An exception is thrown at runtime.
1
4
Compilation fails.
0
第9题:
0
1
4
Compilation fails.
第10题:
test end
Compilation fails.
test runtime end
test exception end
A Throwable is thrown by main at runtime.
第11题:
0
1
4
Compilation fails.
An exception is thrown at runtime.
第12题:
a b c
1 2 3
a1b2c3
a1 b2 c3
第13题:
Given: 11. String test = "This is a test"; 12. String[] tokens = test.split("/s"); 13. System.out.println(tokens.length); What is the result?()
第14题:
public class Test { private static float[] f = new float[2]; public static void main(String args[]) { System.out.println(“f[0] = “ + f[0]); } } What is the result?()
第15题:
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?()
第16题:
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
第17题:
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”?()
第18题:
Given: 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,correctly splits test into "Test A","Test B",and "Test C"?()
第19题:
baz =
baz = null
baz = blue
Compilation fails.
An exception is thrown at runtime.
第20题:
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.
第21题:
null
zero
some
Compilation fails.
An exception is thrown at runtime.
第22题:
String regex = ;
String regex = ;
String regex = .*;
String regex = //s;
String regex = //.//s*;
第23题:
NULL
Compilation fails.
The code runs with no output.
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.