File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

constructor with private access modifier

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A private constructor means only code within the class itself can instantiate an object of that type, so if the private-constructor class wants to allow an instance of the class to be used, the class must provide a static method or variable that allows access to an instance created from within the class.

I didnot uderstand this point :If the private-constructor class wants to allow an instance of the class to be used, the class must provide a static method or variable that allows access to an instance created from within the class.

Please make me understand this point
Thanks in advance
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a plain and clear English sentence, but your native language probably isn't English. I'll try to explain it with code.

An example of where this technique is useful is in the implementation in Java of the singleton design pattern.
[ August 17, 2006: Message edited by: Jesper Young ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic