What is the use of this and super keywords?
Answers
Answered by
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
21
Answer:
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