Interview Q&A / Object-Oriented Programming

IntermediateQuick answer1 min readUpdated 3 Oct 2026

Can static methods be overridden in Java?

SHORT ANSWER

No. A static method in a child with the same signature hides the parent's one. The call is resolved at compile time from the reference type, so there is no runtime polymorphism.

Explain it simply

Static methods belong to the class, not to any object. Dynamic dispatch needs an object to look at, and static calls have none. So the compiler fixes the target while compiling, from the variable's declared type.

Example

java
class P { static String who() { return "P"; } }
class C extends P { static String who() { return "C"; } }   // hiding, not overriding

P p = new C();
System.out.println(p.who());   // prints: P
System.out.println(C.who());   // prints: C

Adding @Override on the child static method gives a compile error, which is a handy way to check you are not overriding by accident.

What to say in the interview

"Static methods cannot be overridden. A same-signature static method in a subclass hides the parent's, and calls are bound at compile time using the reference type. @Override on a static method fails to compile."

Common mistakes

  • Thinking the output would be C because the object is a C.

#java#static#overriding

Related questions

Practise more Object-Oriented Programming questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Object-Oriented Programming quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.