Multiple choice technology programming languages

A constructor can be declared abstract

  1. True

  2. False

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

Constructors cannot be abstract because they're meant to be called when creating an instance of a class. An abstract class cannot be instantiated directly, so having an abstract constructor would be contradictory. When you inherit from an abstract class, you must call a concrete constructor from the base class. If constructors could be abstract, there would be no guaranteed way to initialize the base class. This is a fundamental rule in object-oriented programming.

AI explanation

A constructor's job is to initialize a newly created instance, which means it must always be directly invokable to produce a concrete object; an abstract method has no body and cannot be invoked directly. Because of this fundamental conflict, Java's language rules disallow the abstract modifier on constructors, making the statement false.