From this Oracle tutorial,
Although
Integer
is a subtype ofNumber
,List<Integer>
is not a subtype ofList<Number>
and, in fact, these two types are not related.The common parent of
List<Number>
andList<Integer>
isList<?>
.
My question is about the second sentence. How can we say that List<?>
is the common parent of List<Number>
and List<Integer>
?
?
stands for an unknown type, which could be any reference type. Even if I say that ?
would be Object
here, Object
being the common parent of Integer
and Number
does NOT mean that List<Object>
becomes a common parent of List<Integer>
and List<Number>
.