
import java.util.Vector;
import java.util.Iterator;

public class VectorIteratorDemo
{
    public static void main(String[] args)
    {
        Vector poem = new Vector(10);

        poem.add("A diller,");
        poem.add("a dollar,");
        poem.add("a ten o'clock vector scholar.");

        System.out.println("The vector poem contains:");

        Iterator i = poem.iterator( );
        while (i.hasNext( ))
            System.out.println(i.next( ));

       i.remove( );

        System.out.println( );
        System.out.println("The vector poem now contains:");

        i = poem.iterator( );
        while (i.hasNext( ))
            System.out.println(i.next( ));

        System.out.println("End of program.");
    }
}
