What happens if you do not call super () in the subclass 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 superclass does not have a no-argument constructor, you will get a compile-time error.

Sizin İçin Seçtik  What is super constructor in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *