I know it's a bit counter-intuitive, but for this you write extends
rather than implements
:
public class GenList<T extends Comparable<T>>{
//Class body.
}
(Note that I also changed the ?
to T
, which I think is what you meant. A reference can have type GenList<?>
, or type GenList<? extends Comparable<String>>
, or whatnot, but it doesn't make sense to declare the class itself as taking a wildcard parameter.)