what is the use of declaring constructor as private?
Answer Posted / ranganathkini
By declaring the class constructor as private, other classes
cannot create instances of the class.
This design is usually used in singleton patterns.
Is This Answer Correct ? | 22 Yes | 2 No |
Post New Answer View All Answers
What is return code?
What do you mean by platform independence? What is an interface?
How do you calculate square roots?
What do you mean by Function Overloading in java?
What is a class component?
What technique can be employed to compare two strings?
What are anonymous inner classes?
Why singleton pattern is better than creating singleton class with static instance?
How do you do descending order in java?
Does java have a compiler?
What are the uses of synchronized keyword?
What does n mean?
Can we declare main () method as non static?
State some advantages of java?
What does mean in regex?