Raw type. References to generic types should be parameterized

Cage<T> is a generic type, so you need to specify a type parameter, like so (assuming that there is a class Dog extends Animal):

private Cage<Dog> cage5 = new Cage<Dog>(5);

You can use any type that extends Animal (or even Animal itself).

If you omit the type parameter then what you wind up with in this case is essentially Cage<Animal>. However, you should still explicitly state the type parameter even if this is what you want.

Tags:

Java

Oop

Generics