what is private constructor?what are the uses of writing
private constructor in our program?
Answer Posted / christian
a common use for a private constructor is to implement the
singletton pattern, which uses a public member variable of
the same type of the class which is defined. A public
getInstance() method uses this private constructor
| Is This Answer Correct ? | 13 Yes | 6 No |
Post New Answer View All Answers
How do you write a good declaration?
What do you mean by light weight and heavy weight components?
What’s the difference between unit, integration and functional testing?
what is the difference between the methods sleep() and wait()? : Java thread
What do you mean by ordered and sorted in collections in java?
How is abstraction implemented in java ?
What is the final field modifier?
What is a method in java?
What is the use of flag?
Why java is object oriented?
Can an object subclass another object?
What is a buffer in java?
How does indexof work?
Why are parameters used in functions?
What is the advantage of OOP in java?