+3 votes
in Class 12 by kratos

What is the use of this and super keywords?

1 Answer

+6 votes
by kratos
 
Best answer

They help us to call a method or field of the same class or to call from the immediate super class. The keyword super references the current object as an instance of the current class'* super class.

"This" is useful in situations where a local variable hides or shadows a field with the same name. It is also used when a method needs to pass the current object to another method.

...