// The Collection, List, and Iterator interfaces are a // part of the java.util package. import java.util.*; public class CreatingCollections { public static void main(String args[]) { // Creates a collection object List list = new ArrayList(); // Uses the add method to add // each element list.add("This is a String"); list.add(new Short((short)12)); list.add(new Integer(35)); // Get an iterator for the input list // and step through each element within the // for statement. for (Iterator i = list.iterator(); i.hasNext(); ) { System.out.print(i.next()); } } }