Coll3.java
Select all
/* Coll3.java David Klick CIS 260 2/8/06 This program demonstrates how an Iterator can be used to cycle through the elements of a Collection. */ import java.util.*; public class Coll3 { public static void main(String[] args) { Vector
v = new Vector
(); v.add("This"); v.add("is"); v.add("a"); v.add("demonstration"); v.add("of"); v.add("the"); v.add("Vector"); v.add("class"); Iterator
iter = v.iterator(); while (iter.hasNext()) System.out.println(iter.next()); } }