Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on Generics

 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..

Thanks
Vipul Kumar.
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry i am mistaken..

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

sorry once again..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic