03-20-2020, 08:43 PM
In The Name OF Allah
Al-Salam Alekum
What is constructor chaining in Java?
In Java, constructor chaining is the process of calling one constructor from another with respect to the current object. Constructor chaining is possible only through legacy where a subclass constructor is responsible for invoking the superclass’ constructor first. There could be any number of classes in the constructor chain. Constructor chaining can be achieved in two ways:
- Within the same class using this()
- From base class using super()
Wa Salam Alekum