this and super Keywords in Java: quick revision, 15 bites
All 15 revision bites from this kit, free and with no sign-up.
Two References, Two Directions
One points inward, one points upward.
`this` refers to the **current object**; `super` refers to the **immediate parent class** of the current object.
Takeaway. `this` = me; `super` = my parent. Both are implicit references available inside instance context.
What Exactly Are this and super?
Not objects — reference variables.
Both are **implicitly available** inside non-static methods and constructors — you never declare them.
Takeaway. They are predefined reference variables, not keywords you instantiate.
Why this Exists: Shadowing Rescue
Same name, two meanings — this breaks the tie.
When a **parameter or local variable** has the same name as an **instance variable**, the local one shadows the field. `this.field` explicitly reaches the object's field.
Takeaway. `this.x` always means the instance field, even when a local `x` exists.
Why super Exists: Reaching the Parent
Override hides the parent — super brings it back.
When a subclass **overrides** a method or **hides** a field, `super.method()` and `super.field` still access the parent version.
Takeaway. `super` gives access to the parent's implementation even after overriding.
Constructor Chaining with this()
One constructor calling another — cleanly.
`this()` invokes another constructor of the **same class**, reducing duplication.
Takeaway. `this(...)` must be the **first statement** in the constructor.
Constructor Chaining with super()
Parent constructor runs before child.
`super(...)` invokes the **parent class constructor** and must be the first statement in the subclass constructor. If omitted, Java inserts `super()` automatically.
Takeaway. Parent constructor always executes before the child's body.
Using this/super in Static Context
Static has no object — so this fails.
Takeaway. No object → no `this`/`super`. Static context is object-free.
this() and super() Cannot Coexist
Only one can be first.
Takeaway. First-statement rule means `this()` and `super()` are mutually exclusive in one constructor.
this vs super at a Glance
Side-by-side, no confusion.
Takeaway. Same syntax shape, different target — memorize the target column.
Real Scenario: Employee and Manager
Inheritance in action with both keywords.
Takeaway. `super` is the standard tool for extending inherited behavior.
Where You'll Actually Use Them
Every framework uses these daily.
Takeaway. These keywords are the backbone of OOP-style Java code.
Return this for Chaining
Chain methods like a pro.
Takeaway. `this` as a return value powers builder and fluent APIs.
Exam Favorite: First-Statement Rule
Examiners love this trap.
Takeaway. Four rules cover most exam questions on this topic.
Remember It as 'Me vs My Parent'
Two words, one mental image.
**this = me** (current object). **super = my parent** (superclass). Whenever you're confused, ask: *am I talking about myself or my parent?*
Takeaway. Anchor `this` to 'me' and `super` to 'parent' — resolves most confusion instantly.
super() Fails Without a No-Arg Parent Constructor
Missing parent constructor = compile error.
Takeaway. Always ensure the parent has a constructor the child can call.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages