super()method in Java

Asked 2 years ago, Updated 2 years ago, 27 views

What is the role of super method in Java? Is it just to call out the creator of the higher class? Please explain about super().

java

2022-09-22 22:09

1 Answers

super() calls for a higher class constructor. However, it calls for a constructor with no parameters. And super (argument1) In this way, the super method can contain parameters. This, of course, serves to invoke a higher class constructor with one parameter. Of course, the parent constructor must have a constructor defined with one parameter.

Another role is to call higher-class methods. It's super.aMethod() like this.


2022-09-22 22:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.