This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt on Generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt on Generics" Watch "Doubt on Generics" New topic

Doubt on Generics

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 219
Hi everyone.

I am referencing SCJP & SCJD kathy Sierra & Bert Bates for my SCJP 1.6 exam.
In the Generics Topic, 613 page he given a code snippet :

Claiming that both sub class objects can be added to List<Animal>. I am using eclipse indigo. It is showing compiler error.

Compiler Error:- The method add(Animal) it the type List<Animal> is not applicable for the arguments <Cat>..

Please clarify me..

Vipul Kumar.

Vipul Kumar
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 219
Sorry i am mistaken..

The code which is given in the 613 page works..Please ignore this thread...

sorry once again..
Don't get me started about those stupid light bulbs.
subject: Doubt on Generics
It's not a secret anymore!