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(2));
listObject.add(new Integer(8));
listObject.add(new Integer(5));
listObject.add(new Integer(1));
Iterator Itr = listObject.iterator();
while(Itr.hasNext())
System.out.print(Itr.next() + " ");
}
}

A. 25 28 52 31
B. 55 31 28 25
C. 31 55 28 25
D. 28 25 55 31
E. None of these
Answer» B. 55 31 28 25


Discussion

No Comment Found

Related MCQs