posted 22 years ago
SubClass extends SuperClass, as a result every constructor of SubClass that will be invoked will have as the first statement in its body a call to a constructor of SuperClass.
Now, if you look at the following line,
public SubClass( int m, int n ) { i = m ; j = m ; } //1
you can see that no ctor is explicitely written, the compiler will add a call to the default SuperClass ctor, which is SuperClass().
The compiler will modify the code like this
public SubClass( int m, int n ) { super();i = m ; j = m ; } //1
The next line
public SubClass( int m ) { super(m ); } //2
provides explicitely a call the SuperClass ctor taking an int as argument so the ctor SuperClass(int i) is needed in the SuperClass too.
val