Multiple choice technology programming languages

an abstract class can have a constructor?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Abstract classes can and often do have constructors. Although you cannot instantiate an abstract class directly, its constructor is called when a concrete subclass is instantiated using super() in the subclass constructor. This is useful for initializing fields defined in the abstract class that are common to all subclasses. The constructor executes before the subclass constructor's code.