阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 201-244#99410 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 201-244#99410

年份:104年

科目:OJCP(SCJP)

203. Given:
 5. import java.util.*; 
6. public class SortOf{ 
7. public static void main(String[] args){ 
8. ArrayList<Integer> a = new ArrayList<Integer>(); 
9. a.add(1); a.add(5); a.add(3); 
10. Collections.sort(a); 
11. a.add(2);
 12. Collections.reverse(a); 
13. System.out.println(a); 
14. } 
15. }
 What is the result?
(A) [1, 2, 3, 5]
(B) [2, 1, 3, 5]
(C) [2, 5, 3, 1]
(D) [5, 3, 2, 1]
(E) [1, 3, 5, 2]
正確答案:登入後查看