I have a Cage class:
public class Cage {
// the construtor takes in an integer as an explicit parameter
...
}
I am
Cage
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 cage5 = new Cage(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
. However, you should still explicitly state the type parameter even if this is what you want.