When a superclass constructor calls a method the subclass overrides, that override runs before the subclass's own field initializers, so it observes the field's default value, not the value assigned in the subclass.
class Base {
Base() {
System.out.println("Base ctor calls describe(): " + describe());
}
String describe() { return "base"; }
}
class Derived extends Base {
String label = "ready";
@Override
String describe() { return "derived label=" + label; }
}
new Derived();
Base ctor calls describe(): derived label=null
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27