1
2
12
Compilation fails.
No output is produced.
An exception is thrown at runtime.
第1题:
public class Alpha{ public static void main( string[] args ){ if ( args.length == 2 ) { if ( args.[0].equalsIgnoreCase(“-b”) ) System.out.println( new Boolean( args[1] )); } } } And the code is invoked by using the command: java Alpha –b TRUE What is the result?()
第2题:
System.out.println(Math.sqrt(-4D)); What is the result?()
第3题:
collie
harrier
Compilation fails.
collie harrier
An exception is thrown at runtime.
第4题:
2
3
12
23
123
Compilation fails.
An exception is thrown at runtime.
第5题:
B
B, followed by an Exception.
Compilation fails due to an error on line 9.
Compilation fails due to an error on line 14.
An Exception is thrown with no other output.
第6题:
Compilation fails.
ClassC is displayed.
The code runs with no output.
An exception is thrown at runtime.
第7题:
peep
bark
meow
Compilation fails.
An exception is thrown at runtime.
第8题:
No output is produced. 1 2 3
No output is produced. 2 3 4
No output is produced. 1 2 3 4
An exception is thrown at runtime. 1 2 3
第9题:
X, followed by an Exception.
No output, and an Exception is thrown.
Compilation fails due to an error on line 14.
Compilation fails due to an error on line 16.
Compilation fails due to an error on line 17.
第10题:
true
null
false
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第11题:
00
0001
000120
00012021
Compilation fails.
An exception is thrown at runtime.
第12题:
Hello
Hello World
Compilation fails.
Hello World 5
The code runs with no output.
An exception is thrown at runtime.
第13题:
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()
第14题:
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
第15题:
r, t, t,
r, e, o,
Compilation fails.
An exception is thrown at runtime.
第16题:
42
420
462
42042
Compilation fails.
An exception is thrown at runtime.
第17题:
abc
null
abcdef
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第18题:
TestA
TestB
Compilation fails.
An exception is thrown at runtime.
第19题:
null
finally
null finally
Compilation fails.
finally exception
第20题:
–2
NaN
Infinity
Compilation fails.
An exception is thrown at runtime.
第21题:
test end
Compilation fails.
test runtime end
test exception end
A Throwable is thrown by main at runtime.
第22题:
7
49
343
Compilation fails.
An exception is thrown at runtime.
第23题:
1
12
14
123
Compilation fails.
An exception is thrown at runtime.