File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructors in a class

 
Ravi Hyd
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic