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
why would you use a synchronized block vs. Synchronized method? : Java thread
Can we extend singleton class?
Explain about collection interface in java?
Can we use different return types for methods when overridden?
Can you inherit from an abstract class java?
What is a line break example?
Explain what are final variable in java?
What is an i/o filter?
Does unicode support all languages?
What is a 16 bit word?
Are registers volatile?
What is the difference between yield() and sleep()?
How many bytes is a char in java?
What do you mean by flow of struts?
Can you pass functions in java?