-
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() + " ");
}
}
-
- 25 28 52 31
- 55 31 28 25
- 31 55 28 25
- 28 25 55 31
- None of these
Correct Option: A
25 28 52 31