1.

What is the output of this program?
 import java.util.*;
public class Collection_AlgorithmsExample
{
public static void main(String args[])
{
LinkedList listObject = new LinkedList();
listObject.add(new Integer(22));
listObject.add(new Integer(28));
listObject.add(new Integer(25));
listObject.add(new Integer(21));
Iterator Itr = listObject.iterator();
Collections.reverse(listObject);
while(Itr.hasNext())
System.out.print(Itr.next() + " ");
}
}

A. 22 28 25 21
B. 21 25 28 22
C. 28 25 22 21
D. 21 22 25 28
E. None of these
Answer» C. 28 25 22 21


Discussion

No Comment Found

Related MCQs