• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on Generics  RSS feed

 
vipul bondugula
Ranch Hand
Posts: 231
  • 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: 231
  • 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..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!