Constructor Chaining in Java - Calling one constructor from another using this and super

Constructor Chaining in Java
In Java, you can call one constructor from another and it’s known as constructor chaining in Java. Don’t confuse between constructor overloading and constructor chaining, former is just a way to declare more than one constructor in Java. this and super keyword is used to call one constructor from other in Java. this() can be used to call another constructor of same class while super() can be used to call a constructor from super class in Java. Just keep in mind that this() in reality calls no argument constructor of the same class while this(2) calls another constructor of the same class which accepts one integer parameter. Similarly super() can be used to call no argument constructor of super class and super with parameter can be used to call other overloaded constructors of parent class. Calling one constructor from other is called constructor chaining in Java, which we saw while discussing constructor overloading in Java
Read more »