Why we use super in java?

Java

1 answer

Answer

1157528

2026-07-20 05:45

+ Follow

The keyWord super is used to refer to the parent class instance of the current class.

Lets say we have a class

class A extends B {

...

public void getName(){

}

...

}

Lets assume the parent class B also has a method getName()

Inside class A if you call getName() it would by default call the current class's method. To make the JVM intentionally call the super class method we can use super

if we say super.getName() then the parent class instance of the method would be called.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.