Computer Science, asked by aryaabhisri9798, 1 year ago

What is the use of this and super keywords?

Answers

Answered by MrPoizon
12

It is used inside a sub-class method definition to call a method defined in the super class. Private methods of the super-class cannot be called. Only public and protected methods can be called by the super keyword.

It is also used by class constructors to invoke constructors of its parent class.

Super keyword are not used in static Method.

Answered by Anonymous
21

Answer:

\bold\pink{❥ᴀ᭄ɴsᴡᴇʀ:⤵}

Explanation:

Super keyword is used to access methods of the parent class while this is used to access methods of the current class. this is a reserved keyword in java i.e, we can't use it as an identifier. this is used to refer current-class's instance as well as static members

Similar questions