阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

年份:104年

科目:OJCP(SCJP)

198. Given: 
11. public static Iterator reverse(List list){ 
12. Collections.reverse(list); 
13. return list.iterator();
 14. }  
15. public static void main(String[] args){ 
16. List list= new ArrayList(); 
17. list.add("1"); list.add("2"); list.add("3");
 18. for(Object obj : reverse(list)) 
19. System.out.print(obj + ", ");
 20. } 
What is the result?
(A) 3, 2, 1,
(B) 1, 2, 3,
(C) Compilation fails.
(D) The code runs with no output.
(E) An exception is thrown at runtime.
正確答案:登入後查看