"SCJP 1.6版考題 136" 修訂間的差異
出自 陳富國維基館
(新頁面: Given: 11. public static void main(String[] args){ 12. try{ 13. args = null; 14. args[0] = "test"; 15. System.out.println(args[0]); 16. }catch(Exception ex) { 1...) |
(無差異)
|
於 2013年3月30日 (六) 03:24 的最新修訂
Given:
11. public static void main(String[] args){
12. try{
13. args = null;
14. args[0] = "test";
15. System.out.println(args[0]);
16. }catch(Exception ex) {
17. System.out.println("Exception");
18. }catch(NullPointerException npe){
19. System.out.println("NullPointerException");
20. }
21. }
What is the result?
A. test
B. Exception
C. Compilation fails.
D. NullPointerException
解答
Ans: C
解說: 子類別例外應先於父類別例外catch
| ||||||||||||||||||||