HTML & JS
import java.util.*;
public class IteratorDemo
{
    public static void main(String args[])
    {
        //create a Hashset to store strings
        HashSet<String> hs = new HashSet<String>() ;

        // store some string elements
        hs.add("India");
        hs.add ("America");
        hs.add("Japan");

        // Add an Iterator to hs.
        Listlterator it = hs.listlterator();

        // Display element by element using Iterator
        System.out.println( "Elements using Iterator: ");
        while (it.hasNext())
            System.out.println(it.next());
    }
}

Generated URL:

Compile Errors :

15: error: cannot find symbol
        Listlterator it = hs.listlterator();
        ^
   class Listlterator
 class IteratorDemo
15: error: cannot find symbol
        Listlterator it = hs.listlterator();
                            ^
   method listlterator()
 variable hs of type HashSet<String>
2 errors

Output:

No Output
Report Bug