4
5
8
9
Compilation fails.
An exception is thrown at runtime.
It is impossible to determine for certain.
第1题:
A.Line 33 must be called within a try block.
B.The exception thrown by method1 in class A is not required to be caught.
C.The method declared on line 31 must be declared to throw a RuntimeException.
D.On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.
第2题:
A.42
B.420
C.462
D.42042
E.Compilation fails.
F.An exception is thrown at runtime.
第3题:
A.Value is: 8
B.Compilation fails.
C.Value is: 12
D.Value is: -12
E.The code runs with no output.
F.An exception is thrown at runtime.
第4题:
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()
第5题:
public class TestString 1 { public static void main(String[] args) { String str = “420”; str += 42; System.out.print(str); } } What is the output?()
第6题:
A.Line 26 prints "a" to System.out.
B.Line 26 prints "b" to System.out.
C.An exception is thrown at line 26 at runtime.
D.Compilation of class A will fail due to an error in line 6.
第7题:
A.4
B.5
C.8
D.9
E.Compilation fails.
F.An exception is thrown at runtime.
G.It is impossible to determine for certain.
第8题:
A.Compilation fails.
B.ClassC is displayed.
C.The code runs with no output.
D.An exception is thrown at runtime.
第9题:
public static void main(String[] args) { for (int i=0;i<= 10;i++){ if( i>6) break; } System.out.println(i); } What is the result?()
第10题:
public class Starter extends Thread { private int x= 2; public static void main(String[] args) throws Exception { new Starter().makeItSo(); } public Starter() { x=5; start(); } public void makeItSo() throws Exception { join(); x=x- 1; System.out.println(x); } public void run() { x *= 2; } } What is the output if the main() method is rum?()