In Java, how do I call a base class's method from the overriding method in a derived class? In Java, how do I call a base class's method from the overriding method in a derived class? java java

In Java, how do I call a base class's method from the overriding method in a derived class?


The keyword you're looking for is super. See this guide, for instance.


Just call it using super.

public void myMethod(){    // B stuff    super.myMethod();    // B stuff}


Answer is as follows:

super.Mymethod();super();                // calls base class Superclass constructor.super(parameter list);          // calls base class parameterized constructor.super.method();         // calls base class method.