File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 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..

Vipul Kumar.

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..
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Doubt on Generics
Similar Threads
wildcards in generics
Generics Question
Generics + Polymorphism