I am going through a past Java exam and I have a question that I'm stuck on.
The question is: "Any constructor either explicitly or automatically calls the constructor of its parent class, which calls its parent, and so on up the class hierarchy. What is the name of this process?
Thanks for your answers!
It's called "constructor chaining"
@Edit: adding source: Oracle's documentation. Courtsey of Oli Charlesworth.
If a subclass constructor invokes a constructor of its superclass, either explicitly or implicitly, you might think that there will be a whole chain of constructors called, all the way back to the constructor of Object. In fact, this is the case. It is called constructor chaining, and you need to be aware of it when there is a long line of class descent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With