I have the first print of the book, so maybe this is different in later ones.
My doubt is about the AnimalDoctorGeneric class which is mostly on page 587.
Here is one the error messages from the book:
From page 588:
The compiler stops us with errors, not warnings. You simply CANNOT assign the individual ArrayLists of Animal subtypes (<Dog>, <Cat>, of <Bird> ) to an ArrayList of the supertype <Animal>, which is the declared type of the argument.
I believe, the compiler cannot assign a java.util.List to a java.util.ArrayList anyway, even if it would have the right type (<Animal> ) . The example should creat ArrayLists instead :
Or change the parameter of the checkAnimals() to List:
Is my book too old? Am I wrong?
Thank you. And just want to use the opportunity to thank the authors for this AWESOME BOOK!
[ April 09, 2008: Message edited by: Irina Goble ]
[ April 10, 2008: Message edited by: Irina Goble ]