阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 151-200#99330 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 151-200#99330

年份:104年

科目:OJCP(SCJP)

189. Given: 
23. Object[] myObjects = { 
24. new Integer(12), 
25. new String("foo"), 
26. new Integer(5), 
27. new Boolean(true) 
28. }; 
29. Arrays.sort(myObjects); 
30. for(int i=0; i<myObjects.length; i++){ 
31. System.out.print(myObjects[i].toString()); 
32. System.out.print(" "); 
33. } 
What is the result?
(A) Compilation fails due to an error in line 23.
(B) Compilation fails due to an error in line 29.
(C) A ClassCastException occurs in line 29.
(D) A ClassCastException occurs in line 31.
(E) The value of all four objects prints in natural order.
正確答案:登入後查看