what is the use of private constructor in core java?
Answers were Sorted based on User's Feedback
Answer / rakesh
Private constructor can be used if we do not want any other
class to instantiate the class. This concept is generally
used in Singleton Design Pattern. The instantiation of such
classes is done from a static public method.
| Is This Answer Correct ? | 54 Yes | 3 No |
Answer / rajib
Whenever we r using singleton class then we use constructor
as private.
| Is This Answer Correct ? | 38 Yes | 6 No |
Answer / deep chandra harbola
private constructor are used to create Sinleton class.
example logger class
for singleton class only one object can be created.
by default member of singleton class are static.
singleton class can not be inherited.
| Is This Answer Correct ? | 29 Yes | 3 No |
Explain the term virtual machine?
when there is a need of jvm then how we can say that java is a platform independent language?
why java is better then .net?
'A class is a template for an object' explain this statement.
0 Answers Akamai Technologies,
What are the java ide’s?
what is the difference between System.exit() and System.exit(1)?
1 Answers eClinical Solutions, eClinical Works, eClinicalWorks,
What are the advantages of exception handling?
What are filterstreams?
What are the rules for naming an array?
How do I get the | symbol on my keyboard?
Can we increase array size dynamically in java?
What is an object’s lock and which object’s have locks?