| Author |
private constructor
|
aakash bhatt
Ranch Hand
Joined: Jan 09, 2003
Posts: 182
|
|
what is the use of private constructor Regards, aakash
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
A class with a private constructor can't be instantiated by code outside that class. There are many uses for this: either to prevent a class from being instantiated altogether (java.lang.System, java.lang.Math) or to control the circumstances under which it's created (java.lang.reflect.Method). A common application of this in user code is to let you create a Singleton -- a class of which only one instance can possibly exist.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Rob Michaelson
Ranch Hand
Joined: Jul 15, 2003
Posts: 36
|
|
I found a good glossary from SUN that mat help with terms http://java.sun.com/docs/glossary.html#P Rob
|
 |
 |
|
|
subject: private constructor
|
|
|