Simple design and simple code but don't compile:
public interface Insertable {
public String getInsertStmt(String table);
}
public class ClassCanBeInserted implements Insertable {
public String getInsertStmt(String table) {}
}
public class SomeClass {
public static void main() {
List<ClassCanBeInserted> list = new ArrayList<ClassCanBeInserted>();
SomeMethod(list);
}
private static void SomeMethod(List<Insertable> list) {}
}
And the call to SomeMethod() won't compile. English poor but the code should explain. Can someone please figure out what's wrong and how to get a design for the propose that a list of interface-implemented classes can be used in such method?
Again, English poor, so may not expressed well. Let me know your questions. Thanks!
Error message given: The method SomeMethod(List) in the type ClassCanBeInserted is not applicable for the arguments (List)