Hi,
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 invocation occurs from the current class up the hierarchy to the ancestor class
Answer to Question 43)
2) constructors cannot be overriden
_________________________________________________________________
The explanation to why choice 4 is wrong is
Option 4 is the inverse of what happens as constructors are called 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. When you create the child class you will see the order of constructor calling.
_________________________________________________________________
My thought was the child class constructor calls the superclass constructor ,
superclass constructor in turn calls the sperclass constructor and so on .
This is done since super() [implicitly by compiler or explicitly by programmer] or
super( parameters )[explicitly by programmer] is called.
So I think the constructors are called from child to parent that is from current class to ancesstor class.
[This happens Exactly like method calls.]
So i think choice 4 is also correct .
Please somebody give suggestions.
Tinu