Styrow.dev
Question 49 of 247
Java Topic: General medium

How to invoke a superclass version of an Overridden method?

Question

How to invoke a superclass version of an Overridden method?

Answer

To invoke a superclass method that has been overridden in a subclass, you must either call the method directly through a superclass instance, or use the super prefix in the subclass itself. From the point of the view of the subclass, the super prefix provides an explicit reference to the superclass’ implementation of the method.

// From ubclass super.overriddenMethod();