super Keyword in Java — Uses and Rules
Fast recall
Quick revision
Core answer
super refers to the parent class of the current object. It has three uses: super() calls the parent class constructor and must be the first statement in a subclass constructor; super.method() invokes the parent's version of an overridden method so you extend rather than replace its behavior; and super.field accesses a parent field when a subclass field hides it with the same name (rare in practice).Knowledge of all three uses of super and understanding that super() must be the first statement in a constructor.
Thinking super.field is commonly needed — field hiding is rare; the critical uses are super() for initialization and super.method() for extending behavior.
Explain that super.method() is essential when you want to extend rather than replace parent behavior — like adding logging before calling the parent's validation logic.
Interview-ready guide
Interview answer
super is how a subclass talks to the parent part of itself — its constructor, its methods, its fields. The use that matters most is super(args), the call to the parent constructor, and it has to be the first statement because Java builds objects from the parent down: the parent has to be fully set up before any subclass code runs. Java will insert a no-arg super() automatically, but only when the parent actually has a no-arg constructor — if it only takes arguments, you pass them yourself or it won't compile.
The second use is the one I'd emphasize to show depth: super.method() lets you extend behavior instead of replacing it. When you override a method you wipe out the parent's version, so calling super.describe() brings it back and you build on top. That's exactly why frameworks like Android and Spring insist you call super in their lifecycle methods — leave it out and their own setup silently never runs, which is the kind of bug that takes hours to find.
super Keyword in Java — Uses and Rules
Direct Answer
super refers to the parent class of the current object. It has three uses: super() calls the parent class constructor and must be the first statement in a subclass constructor; super.method() invokes the parent's version of an overridden method so you extend rather than replace its behavior; and super.field accesses a parent field when a subclass field hides it with the same name (rare in practice).
Code Example
class Account {
protected double balance;
// Parent constructor — requires a balance argument
Account(double balance) {
this.balance = balance;
}
String describe() {
return "Balance: " + balance;
}
}
class SavingsAccount extends Account {
private double rate;
SavingsAccount(double balance, double rate) {
super(balance); // super() MUST be first — passes balance to Account constructor
// If you write ANY statement before super(), it is a compile error
this.rate = rate; // only runs after parent is initialized
}
@Override
String describe() {
// super.describe() calls Account's version — extend, don't replace
return super.describe() + ", rate: " + rate;
}
}
public class SuperDemo {
public static void main(String[] args) {
SavingsAccount sa = new SavingsAccount(1000.0, 0.04);
System.out.println(sa.describe());
// Output: Balance: 1000.0, rate: 0.04
// Without super.describe() we'd print only ", rate: 0.04"
}
}
Common Mistakes & Pitfalls
- Assuming Java always inserts
super()for you — it only inserts the no-arg call; if the parent has only parameterized constructors, your subclass won't compile until you writesuper(args)yourself. - Overriding a framework method without calling
super— skippingsuper.onCreate()orsuper.doFilter()silently drops the framework's own logic and produces bugs that are brutal to trace. - Treating
super.fieldas a normal tool — needing it means a subclass field is hiding a parent field of the same name, a design smell you should usually rename away. - Trying to put code before
super(...)— it must be the first statement, so you cannot validate arguments or log anything before the parent is constructed.
Check your understanding
Answer these without looking back at the article.
- Can you call super.method() from a static method?
- What is the difference between super.method() and calling the parent method normally?
- Can super refer to a grandparent class?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.