aspose file tools
The moose likes Java in General and the fly likes Constructors in a class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Constructors in a class" Watch "Constructors in a class" New topic
Author

Constructors in a class

Ravi Hyd
Greenhorn

Joined: Jun 27, 2005
Posts: 4
I want to know whether we can create a Private default constructor in a class. Can anybody explain what is Singleton class?
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
Yes, it is possible to create a private default Constructor.

If all constructors are private you cannot create an instance from outside that class.

If you create a public static method that always returns the same instance of that class you have used the singleton pattern.

Look at the example:

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Constructors in a class
 
Similar Threads
How to get current date in October 10, 2005. 9.30 a.m format
.....
Doubt
connection pooling in struts
Java Network Question, pls help