• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on Generics

 
vipul bondugula
Ranch Hand
Posts: 228
  • 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: 228
  • 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..
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!