Re: Java/J2EE interview Questions hey guys,
What are the situations you will need a constructor to be private?
Below are some of the situations when you will need a constructor to be private:-
To implement singleton pattern. That means only one instance of the object need tobe running.
When classes contain static methods. It makes sense that no object of the class needto be created.
If classes have only constants.
__________________ Venkat knowledge is Power |