posted 16 years ago
An ArrayList<Animal> can accept references of type Dog, Cat, or any other
subtype of Animal (subclass, or if Animal is an interface, implementation).
The above line is from the 2-minute drill of Generics chapter.
Could anyone please explain what this means? I cannot follow what it says. I thought List<Animal> takes only List<Animal>. Please explain with a small example.
Appreciate any help
Thank you.