单项选择题

static void test() throws RuntimeException { 
try { 
System.out.print(”test “); 
throw new RuntimeException(); 
} 
catch (Exception ex) { System.out.print(”exception “); } 
} 
public static void main(String[] args) { 
try { test(); } 
catch (RuntimeException ex) { System.out.print(”runtime “); } 
System.out.print(”end “); 
} 
What is the result?() 

A. test end
B. Compilation fails.
C. test runtime end
D. test exception end
E. A Throwable is thrown by main at runtime.


您可能感兴趣的试卷

你可能感兴趣的试题

7.单项选择题

11. static class A { 
12. void process() throws Exception { throw new Exception(); } 
13. } 
14. static class B extends A { 
15. void process() { System.out.println(”B”); } 
16. } 
17. public static void main(String[] args) { 
18. new B().process(); 
19. } 
What is the result?() 

A. B
B. The code runs with no output.
C. Compilation fails because of an error in line 12.
D. Compilation fails because of an error in line 15.
E. Compilation fails because of an error in line 18.

8.单项选择题

11. static classA { 
12. void process() throws Exception { throw new Exception(); } 
13. } 
14. static class B extends A { 
15. void process() { System.out.println(”B “); } 
16. } 
17. public static void main(String[] args) { 
18.A a=new B(); 
19. a.process(); 
20.} 
What is the result?() 

A. B
B. The code runs with no output.
C. An exception is thrown at runtime.
D. Compilation fails because of an error in line 15.
E. Compilation fails because of an error in line 18.
F. Compilation fails because of an error in line 19.