8.22.4.You cannot add non-related class to generic collection instance
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);
myVec.add("");
}
}
class MyClass {
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method add(MyClass) in the type Vector is not applicable for the arguments (String)
at MainClass.main(MainClass.java:10)