What is private constructor in Java example?

The use of private constructor is to serve singleton classes . A singleton class is one which limits the number of objects creation to one. Using private constructor we can ensure that no more than one object can be created at a time.

Sizin İçin Seçtik  What defines you as an employee?

Leave a Reply

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