With Java 5 this has changed:
Java 5 permits
covariant return types.
This means that Java 5 does not insist
that the return type of an overriding method
is the same type
as the return type of the method in the superclass:
it can be a subclass of that return type.
So, in Java 5,
Circle's
translate
method can have the header:
0367: public Circle translate(int pX, int pY)
And the call of this
method can then be simplified to:
0406: Circle tCircle = new Circle(x, y, radius);
0407: Circle tNewCircle = tCircle.translate(1, 2);
0408: System.out.println(tNewCircle.getRadius());