Declaration like this :
class A<X extends Number & List> { }
is allowed.Whereas declaration like this is not allowed.
class A<? extends Number & List> { }
Is there any logical explanation about why Java restricts us to do that?
& what's the actual difference between
<T extends Number>
& <? extends Number>?
The whole point of a type parameter like T
is so that you can use it as a type inside the class. What would a wildcard there even mean? If you can't use it anywhere, why have a type parameter at all?