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 generics in java interview questions?
What is the public field modifier?
What is multithreading and its advantages?
What is strings in java?
What is a blocking method in Java?
List any five features of java?
What’s the difference between the methods sleep() and wait()?
What are three ways in which a thread can enter the waiting state in java programming?
What is object-oriented programming?
Can we force garbage collector to run ?
What's the access scope of protected access specifier?
What does s mean in regex?
Explain about doubly linked list
Difference between error and exception
Difference between throw and throws?