I'm learning Java generics type and I saw some syntax like <? super T>
, <? extends T>
and <T extends SomeClass>
.
If:
public class MyClass<T extends Number> {}
means MyClass can be constructed only with a generic type that is the subclass of Number,
what would be the correct syntax for declaring a class that only accepts Number and its superclass as its generic type, like:
//public class MyClass<T super Number> {}