Darla SandyKnowledge Contributor
What is the difference between 'this' and 'super' keywords?
What is the difference between 'this' and 'super' keywords?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
In programming, particularly in Java, the this and super keywords have distinct purposes:
The **this** keyword is used within an instance method or a constructor to refer to the current object. It’s often used to eliminate ambiguity between class attributes and parameters with the same name, or to invoke other constructors of the same class in a process known as constructor chaining.
The **super** keyword is used to access members (methods or variables) of the parent class. It can be used to call the superclass’s constructor, and it’s also used when subclass methods want to call overridden methods in the superclass.