Java67 - Java Program Example Tutorial Blog

Java67 - Java Program Example Tutorial Blog


How Constructor Chaining works in Java - Example

Posted: 31 Dec 2012 05:07 AM PST

How to call one constructor from other constructor in Java or What is Constructor Chaining in Java is one of the tricky questions in Java interviews. Well you can use this keyword to call one constructor from other constructor of same class, if you want to call constructor from based class or super class than you can use super keyword. Calling one constructor from other is called Constructor chaining in Java. Constructors can call each other automatically or explicitly using this() and super() keywords. this() denotes a no argument constructor of same class and super() denotes a no argument or default constructor of parent class. Also having multiple constructor in same class is known as constructor overloading in Java.
Read more »


1 comment:

  1. Hi,
    Thanks for sharing. very useful.

    http://www.flowerbrackets.com/create-file-java-program/

    ReplyDelete