File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Doubt on Generics

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
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.


Thanks
Vipul Kumar
vipul bondugula
Ranch Hand

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

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

sorry once again..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on Generics