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
How does arraylist work in java?
Is there any tag in htm to upload and download files?
What is == and === in javascript?
Can we instantiate interface in java?
Can we call a non-static method from inside a static method?
What is the purpose of the file class in java programming?
What is boolean flag in java?
what is the volatile modifier for? : Java thread
What is the major drawback of internal iteration over external iteration?
Can a source file contain more than one class declaration?
What are the differences between checked exception and unchecked exception?
Explain the importance of finalize() method.
What is difference between public static and void?
What is concurrent hashmap and its features?
Why method overriding is used?