Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Sunny Jain wrote:You may want to look here -
How polymorphism works in Generic
Adolfo Eloy
Software Developer
OCPJP 6
OCPJP 6
Kim Ming Yap wrote:Had it been something like <? extends Numbers> in other words not Objects (which is the highest class in Java) i would understand the unchecked warning. But since Object is the highest class in the class hierarchy, i don't see a problem.
SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Kathy Sierra 6 .SCJP book . In Page 618 of the book that i have wrote:
public void addAnimal(List<? extends Animal> animals)
By saying <? extends Animal>, we're saying, "I can be assigned a collection
that is a subtype of List and typed for <Animal> or anything that extends Animal.
And oh yes, I SWEAR that I will not ADD anything into the collection."
SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Kathy Sierra 6 .SCJP book . In Page 618 of the book that i have wrote:
public void addAnimal(List<? extends Animal> animals)
By saying <? extends Animal>, we're saying, "I can be assigned a collection
that is a subtype of List and typed for <Animal> or anything that extends Animal.
And oh yes, I SWEAR that I will not ADD anything into the collection."
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|