educative.io

Logic behind using super() in normal / base class

why does the constructor of base class has super(); call in its constructor ? what is the logic and use of using super(); in base class ? is it not implicit ?


Course: https://www.educative.io/collection/5352985413550080/4785082259734528
Lesson: https://www.educative.io/collection/page/5352985413550080/4785082259734528/5024380582100992

Hi @Pavan1,
Thanks for sharing your feedback with us. The super() function call is used to call the constructor of the parent class. In this particular example, the constructor of the parent class doesn’t have any statement to execute. We can run the program without the super() function call. This would help if we have an executable code in the constructor of the parent class.
This answer might be helpful: https://www.educative.io/answers/what-is-the-super-keyword-in-java

If you have any other query, please feel free to ask!
Thanks.

In the section “Creating a Servlet” - I spent nearly 30 mins on understanding why the server link is not working even though I see that war is running on tomcat in the console only to realize that link given is wrong. The amount of misinformation and confusing details in the course is really frustrating.


Course: https://www.educative.io/collection/5352985413550080/4785082259734528
Lesson: https://www.educative.io/collection/page/5352985413550080/4785082259734528/5207094647586816