1.

What is the output of this program?
import java.util.*;
public class Collection_iterators_Example
{
public static void main(String args[])
{
LinkedList listobject = new LinkedList();
listobject.add(new Integer(10));
listobject.add(new Integer(9));
listobject.add(new Integer(6));
listobject.add(new Integer(11));
Iterator Itr = listobject.iterator();
Collections.reverse(listobject);
Collections.sort(listobject);
while(Itr.hasNext())
System.out.print(Itr.next() + " ");
}
}

A. 10 9 6 11
B. 10 9 6
C. 6 9 10 11
D. 11 10 9 6
E. None of these
Answer» D. 11 10 9 6


Discussion

No Comment Found

Related MCQs