Prithvi Sehgal wrote:Hello,
Please have a look at GenericsConfusion
I have tried to explain the concept, if still don't understand. Refer back.
Hope this helps,
Prithvi Sehgal wrote:Hi,
I doubt that we can add anything to the list. The reference has to be used to call methods so that w can get
polymorphic behavior. If you want to add something to the list, you got to change it to somewhat
If we are mantaining Dog,Cat, Animal heirarchy
k fine List<? super Dog> animalList for adding Dog or sub-type of Dog .What about List<? extends Dog> animalList you mean its impossible to add objects for animallist .If so why?If not how?I hope this discussion will be closed with your coming reply.
Hope this helps