View Single Post
  #3  
Old 08-21-2007, 08:28 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 347
Venkat is on a distinguished road
Thumbs up 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
Reply With Quote