MCQOPTIONS
Saved Bookmarks
| 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(3)); listObject.add(new Integer(9)); listObject.add(new Integer(7)); listObject.add(new Integer(2)); Iterator itr = listObject.iterator(); Collections.reverse(listObject); while(itr.hasNext()) System.out.print(itr.next() + " "); } } |
| A. | 2 7 9 3 |
| B. | 3 9 7 2 |
| C. | 2 3 7 9 |
| D. | 7 9 3 2 |
| E. | None of these |
| Answer» B. 3 9 7 2 | |