The list is declared to accept instances of Animal.
Since Cat extends Animal, a Cat IS-AN Animal. Since Dog extends Animal, a Dog IS-AN Animal. So there is no problem adding these to the List.
The thing to consider is that everything you get out of the List will be a reference of type Animal, so if you intend to downcast back to Cat or Dog, you will need to take some precautions (e.g., check the actual type using instanceof before downcasting). [ July 04, 2007: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org