Hi,
Can anyone tell me why this program calls Super's constructor, although there is no call made to it by super() in Sub's constructor ?
class Super {
Super(){
System.out.println("In Super constructor");
test();
}
void test() {
System.out.println("In Super.test()");
}
}
class Sub extends Super {
Sub() {
System.out.println("In Sub constructor");
}
void test() { // overrides test() in Super
System.out.println("In Sub.test()");
}
}
Output if Sub sb = new Sub() is invoked:
In Super Constructor
In Sub.test()
In Sub Constructor
Thanks,
Stephane