Question 43)
Which of the following statements are true
1) constructors cannot be overloaded
2) constructors cannot be overridden
3) a constructor can return a primitive or an object reference
4) constructor code executes from the current class up the hierarchy to the ancestor class
The answer is given as 2. A part of the explanation is -
Option 4 is the inverse of what happens as constructor code will execute starting from the oldest ancestor class downwards. You can
test this by writing a class that inherits from a base class and getting the constructor to print out a message.
-----------
But I chose option 4 too. Though apparently the object is constructed from the top most class in its hierarchy, this construction is a consequence of a call to super(), or a variant of super(), from the constructors in the derived class. Moreover, the wordings in option 4 is "constructor code
executes..."
Any comments? Thanks.