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
Can you change array size in java?
What is the difference between procedural and object-oriented programs?
Can we make main() thread as daemon?
Why do we use return statement?
What is square root in java?
Is 0 a real number?
How do you use compareto in java?
Give few difference between constructor and method?
Explain the difference between abstract classes and interfaces in java?
What is serialversionuid?
What is final class?
What are measurable parameters?
What are static initalizers in java ?
Difference between object instantiation and construction ?
Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?