import java.util.Vector; public class MainClass { public static void main(String[] argv) { Vector<MyClass> myVec; myVec = new Vector<MyClass>(); MyClass myClass = new MyClass(); myVec.add(myClass); MySubclass sub = new MySubclass(); myVec.add(sub); } } class MyClass { } class MySubclass extends MyClass { }