In object-oriented programming, constructor chaining is the technique of creating an instance of a class with multiple constructors, then using one constructor to call another. The primary use of constructor chaining is to make a program simpler, with fewer repeated lines of code.
How does it work?
In a language like Java, a class can be thought of as a template for structured data, in which all characteristics and actions defined generally. An instance of the class is a specific data structure with unique values within this defined structure.
Normally, a class has a special method that shares the exact name as the class itself. This method, called a constructor, will be executed automatically when a new instance of the class is created. Using ad hoc polymorphism, multiple constructor methods can share the same name and call each other, giving the programmer more options as to how an instance might be created.