Note that by saying <? super Number> we're not saying super classes of Number(as defined for the class), we're saying any & all subclasses of Number. Think of it as simply List.
And yes - "Nothing lower in the inheritance tree can come in, but anything higher than Number is OK" is an incorrect statement.
<? super Number> we're not saying super classes of Number(as defined for the class), we're saying any & all subclasses of Number
Originally posted by Lakuma Yalamanchili:
Venkata,
So <? super Number> indicates any class that has Number as it's super class or Number itself!
<? extends Number> indicates any class that extends Number or Number itself!
<? super Number> we're not saying super classes of Number(as defined for the class), we're saying any & all subclasses of Number
Originally posted by Lakuma Yalamanchili:
So I was right when I thought the following is wrong??
[ October 03, 2008: Message edited by: Lakuma Yalamanchili ]
Venkata,
Yes there is a section in Chapter 7 - K&B about using super with Generics
scjp5 90%
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|