When I try to override a method that takes a List
, I get the following compile error.
Multiple markers at this
To add to the answers already here, I want to comment about the signature of the methods is the same after erasure
... but the compiler checks the method type before erasure.
You could do something like creating a "different" Parent
class, such as
class Parent {
public void getname(List num) {
System.out.printf("child class: %s",num);
}
}
, compile it, use it to compile Child
class, and then mix your original Parent.class
and Child.class
in the same JVM without issue, avoiding the compiler checks and using type erasure.
But as long as the compiler notices doing something like that "in the same run", it will fail by the reasons explained by Ashot and Louis.