Interview Q&A / Object-Oriented Programming

IntermediateQuick answer1 min readUpdated 3 Oct 2026

Can an abstract class have a constructor? Why would it need one?

SHORT ANSWER

Yes. It cannot be instantiated directly, but a subclass constructor calls it with super() so the parent's fields get initialised.

Explain it simply

An abstract class is a half-built foundation. You never move into it, but every house built on it still needs the foundation laid properly. The constructor does that setup work when a concrete child object is created.

Example

java
abstract class Vehicle {
    protected final String regNo;
    Vehicle(String regNo) {                  // legal and common
        this.regNo = regNo;
        System.out.println("Vehicle ready: " + regNo);
    }
    abstract int wheels();
}

class Auto extends Vehicle {
    Auto(String regNo) { super(regNo); }     // runs the abstract class constructor
    int wheels() { return 3; }
}

new Auto("JH05-1234");   // prints: Vehicle ready: JH05-1234

Calling an overridable method from an abstract class constructor is risky: the child's fields are not yet set at that moment.

What to say in the interview

"Yes, abstract classes have constructors, used through super() to initialise shared fields. The class cannot be instantiated on its own, but its constructor runs whenever a concrete subclass object is built."

Common mistakes

  • Saying abstract classes cannot have constructors because they cannot be instantiated.

#abstract-class#constructors#java

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.