Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (4k points)
Is super() used to call the parent constructor? Please explain super().

1 Answer

0 votes
by (46k points)

super() calls the parent constructor with no arguments.

It can be practiced also with arguments. I.e. super(argument1) and it will call the constructor that accepts 1 parameter of the model of argument1 (if exists).

Also, it can be applied to call methods from the sire. I.e. super.aMethod()

Added info and tutorial here

Browse Categories