import java.util.Iterator; import java.util.Vector; public class MainClass { public static void main(String[] argv) { Vector<MyClass> vec = new Vector<MyClass>(); vec.addElement(new MyClass()); Iterator<MyClass> iter = vec.iterator(); while (iter.hasNext()) System.out.println(iter.next().intValue); } } class MyClass { public int intValue = 9; }