I have:
public class<E extends aninterface> AClass{
public AClass(){
}
public void amethod(E element){
//something
}
}
public class B implements aninterface{
}
in call code:
aninterface f = new B();
AClass<B> ac = new AClass<B>();
ac.amethod(f);
It say f is type aninterface but parameter is type ‘E’
I not understand what point of generics if I cannot do this?
Because
AClass<B>.amethod()expects aBas the argument. But you’re passing it ananinterface.