From this Oracle tutorial,
Althoughis a subtype of
Numberis not a
subtype ofand, in fact, these two types are not related.
The common parent ofand
The context you need to understand is not of
Number but it's the
List. Let's suppose you were the one creating the
List class then how would you create the class so it will only support a specific type of class.
List class won't use Object as its type but instead use a wild card
As documentation of WildCards say
So what is the supertype of all kinds of collections? It's written
Collection<?>(pronounced "collection of unknown")
Same thing can be said for List.
So what is the supertype of all kinds of Lists? It's written
List<?>(pronounced "List of unknown")