Which of the following statements about no-argument constructors is correct?
If a parent class
B.
If a parent class does not include a no-argument constructor, a child class can still explicitly declare one; it just has to call an appropriate parent constructor with super()
.
Option A is incorrect.
If a parent class does not include a no-argument constructor, the child class must explicitly declare a constructor, since the compiler will not be able to insert the default no-argument constructor.
Option B is correct.
Option C is incorrect because a parent class can have a no-argument constructor, while its subclasses do not.
If Option C was true, then all classes would be required to have no-argument constructors since they all extend java.lang.Object, which has a no-argument constructor.
Option D is incorrect.
The default no-argument constructor can be inserted into any class that directly extends a class that has a no-argument constructor.
No constructors in the subclass are required.