Skip to main content

What is the difference between this and super keywords?

Entry Java
Quick Answer this refers to the current class instance - used to distinguish instance variables from local variables, or call other constructors (this()). super refers to the parent class - used to call parent class methods (super.method()), access parent fields (super.field), or call the parent constructor (super()) - which must be the first line in the child constructor.

Answer

this: Refers to current instance.
super: Refers to parent class.
Used to call parent constructors and resolved naming conflicts.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice