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
Difference between string, stringbuffer and stringbuilder?
What is the significance of continue jump statement? Explain with an example.
What is string syntax?
How to sort double array in java?
Is java hashset ordered?
What is treeset in java collection?
Explain a situation where finally block will not be executed?
What is the purpose of using java.lang.class class?
What do you know about the garbage collector in java?
Is nullpointerexception checked or unchecked?
Why javac is not recognized?
How many ways can you break a singleton class in java?
Why is core java important?
Should a main method be compulsorily declared in all java classes?
Is array an object in java?