Posted by skyrider
on November 29, 2008 at 6:18 AM PST
I've got a question regarding the tutorial "Learning the Java Language", chapter "Interfaces and Inheritance", section "Using the Keyword super" where it says:
Note: If a constructor does not explicitly invoke a superclass constructor, the Java compiler automatically inserts a call to the no-argument constructor of the superclass. If the super class does not have a no-argument constructor, you will get a compile-time error. Object does have such a constructor, so if Object is the only superclass, there is no problem.
I have declared a class Parent, class Child extends Parent and class Grandchild extends Child with no constructors in none of them, so I expected a compile-time error in Child and Grandchild (as their superclass wasn't Object), but it all compiled and executed just fine. So is there an error in the tutorial, or did I missunderstand something? Thank you.