// The structure package contains the definition of the Vector class // The same code could be used with the standard Vector class (from // Java collection) by using import java.util.* import structure.*; class VectorTest { public static void main(String[] args) { // Defines x as a reference/pointer to a Vector object Vector x; // Allocates space for x by calling a constructor in // the Vector class that takes a single argument that // specifies the initial capacity of the Vector. x = new Vector(10); // The Vector class contains a method called add that // appends to the end of the Vector. So the class keeps // track of the end for us. // The end of the Vector is given by the number of adds // minus the number of removes performed on the Vector x.add("10"); x.add("12"); x.add("14"); for(int i = 0; i < 10; i++) System.out.println(x.get(i)); } }