If I have the following interface and I want to implement it
public interface A<E extends Comparable<E>>{
//code
}
What is the correct syntax for the implementing class declaration? I get an error when I do this
public class B<E extends Comparable<E>> implements A<E extends Comparable<E>>{}
Should it just read implements A<E> or just implements A?
Where the
ComparabletypeEis, for example,String, you would want:Where you want to retain the generic type parameter declaration in
B, you would have:Note that the
EinAis not related to theEinB, i.e. the following is valid:(whether you want to distinguish or not in your code I don’t know, but it might help in understanding)