How do you call a constructor from another class constructor?

To call one constructor from another constructor is called constructor chaining in java. This process can be implemented in two ways: Using this() keyword to call the current class constructor within the “same class”. Using super() keyword to call the superclass constructor from the “base class”.

Sizin İçin Seçtik  What if superclass has no constructor?

Leave a Reply

Your email address will not be published. Required fields are marked *