Hi,
I was going through one of the examples in the K&B SCJP5 book.
Here is the code that i tried out:
In the TestGenerics class i call the method in the Dog class, the code is:
It does not compile as argument passed to the method does not match that with the method signature as in the Dog class.
And hence the error:
D:\JAVA\shekhar java\sudipto nw\TestA.java:35: addAnimal(java.util.List<Dog>
in Dog cannot be applied to (java.util.List<capture of ? super Dog>
((Dog)dogList.get(0)).addAnimal(dogList);// this line does not compile
^
1 error
My question is the List dogList is of what generic type, as passing the list to the method in Dog class resulted in error and so it is not of type <Dog>. Please explain...
It is just a question so feel free to answer.
Thank you.
