You may find situation to limit the number of objects creation for your class due to various reasons. For example you are developing a class for allowing users to access your custom webservice using your API.
And in this you want to impose a limit, so you can use this functionality.
Check following tutorial for source code:
How to limit object creation in Java?
Thanks