implicit super constructor Person() is undefined. Must explicitly invoke another constructor?

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.

Reference: : (See under section ‘SubClass Constructors’)

So whenever dealing with parameterized constructors make a super(parameter1, parameter2 ..) call to the parent constructor. Also this super() call should be the FIRST line in your constructor block.

Leave a Comment