What will be the output of the following Java program?

import java.util.*;
class Collection_iterators 
{
    public static void main(String args[]) 
    {
        ListIterator a = list.listIterator();
            if(a.previousIndex()! = -1)
                while(a.hasNext())
                System.out.print(a.next() + " ");
            else
               System.out.print("EMPTY");
    }
}

a) 0
b) 1
c) -1
d) EMPTY

1 thought on “What will be the output of the following Java program?”

Leave a Comment