Java examples for Object Oriented Design:Inheritance
When you create an instance of a subclass, Java automatically calls the default constructor of the base class before it executes the subclass constructor.
For example, consider the following classes:
class Ball { public Ball() { System.out.println( "Hello from the Ball constructor"); } } class BaseBall extends Ball { public BaseBall() { System.out.println( "Hello from the BaseBall constructor"); } }