欢迎来到牛牛题库网 牛牛题库官网
logo
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

public static Iterator reverse(List list) { 
Collections.reverse(list); 
return list.iterator(); 
} 
public static void main(String[] args) { 
List list = new ArrayList(); 
list.add(” 1”); list.add(”2”); list.add(”3”); 
for (Object obj: reverse(list)) 
System.out.print(obj + “,”); 
} 
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.

点击查看答案&解析
微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题