Worked example
abstract class Shape {
public abstract double area();
public String describe() {
return getName() + " has area " + area(); // calls the subclass's area()
}
}
Shape c = new Circle(1);
Shape r = new Rect(2, 3);
System.out.println(c.describe()); // Circle has area 3.14
System.out.println(r.describe()); // Rect has area 6.0
describe() is written once, yet each shape describes itself correctly.