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 are constants and how to create constants in java?
What are the types of inner classes (non-static nested class) used in java?
What is tcp and udp?
Is oracle charging for java?
Explain about public and private access specifiers?
How do I print a “?
Can we override private method in java?
How is it possible for two string objects with identical values not to be equal under the == operator?
Is java 1.7 the same as java 7?
What do you mean by ternary operator in java?
What is a “stateless” protocol ?
What is the file type?
What is array length?
How to run a JAR file through command prompt?
Can java cast null?