Where do we use constructor in Java?

A constructor is used to initialize objects in Java. It is called when an object of a class, using the new() keyword, is created and can be used to set initial values to the data members of that same class.

Sizin İçin Seçtik  How many types of constructor are there in C++?

Leave a Reply

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