Home » JAVA Programming » Collections » Question
  1. What is the output of this program?
    import java.util.*;
    public class Collection_iterators_Example
    {
    public static void main(String args[])
    {
    ListIterator object = List.istIterator();
    if(object.previousIndex()!= -1)
    while(object.hasNext())
    System.out.print(object.next() + " ");
    else
    System.out.print("EMPTY");
    }
    }
    1. Compilation Error
    2. Runtime Error
    3. EMPTY
    4. empty
    5. None of these
Correct Option: A

Output:

Collection_iterators_Example.java:6: error: cannot find symbol
ListIterator object = List.istIterator();
^
symbol: method istIterator()
location: interface List
1 error



Your comments will be displayed only after manual approval.