what is the use of private constructor in core java?
Answer Posted / 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 |
Post New Answer View All Answers
Define how objects are stored in java?
Can we have more than one package statement in the source file?
What is a variable simple definition?
How do you read and print a string in java?
What are java packages? What's the significance of packages?
Can you sort a list in java?
What is static variable with example?
Explain where variables are created in memory?
Define jit compiler?
What are the types of casting?
Why are data types important?
Can we execute java program without main method?
List out five keywords related to exception handling ?
Can you explain inner class.
What will happen to the exception object after exception handling?