default constructor in SuperClass?

Question ID :957621799662 Consider the following subclass definition: public class SubClass extends SuperClass { int i, j, k; public SubClass( int m, int n ) { i = m ; j = m ; } //1 public SubClass( int m ) { super(m ); } //2 } Which of the following constructors MUST exist in SuperClass for SubClass to compile correctly? The answer of this question is: public SuperClass(int a) public SuperClass() I know the first one is absolutely right, but how about the second one? Since SubClass will not call the default constructor in SuperClass, it does it must exist in order to compile fine?

The thing to remember here is that you have to remember if you provide any other constructors in the super class, than the default constructor is NOT automatically provided. So since super(m) is declared, obviously like you mentioned you must provide that constructor that takes an int, but since you had to provide that constructor in the super class you now must actually declare the constructor with no arguments if you are going to have any code that will implicity call super() like Valentin mentions will happen in the SubClass in the second method. Sorry if that explanation is not too clear. All the Java cert books cover this topic well.