what is the use of declaring constructor as private?
Answer Posted / anshul
A private constructor is a special instance constructor. It is commonly used in classes that contain static members only. If a class has one or more private constructors and no public constructors, then other classes (except nested classes) are not allowed to create instances of this class.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is a parameter in a function?
How do you take thread dump in java?
Why convert an applet to an application?
Why do we need singleton?
What is stringjoiner ?
What is the difference between state-based unit testing and interaction-based unit testing?
I want to print “hello” even before main is executed. How will you acheive that?
Does java return by reference?
Explain abstract class in java?
Can we clone singleton class in java?
When do you call copy constructor?
How to create a fecelet view?
What is codebase?
How many bits is a string?
How are observer and observable used in java programming?