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
What are the benefits of immutable objects?
What is difference between classpath and path variables in java?
What does file separator do in java?
Explain when we should make an instance variable private.
What is variable explain with example?
Can you pass functions in java?
What does java ide mean?
What is int argc char * argv?
What are different types of inner classes ?
What is the final access modifier in java?
What causes memory leaks in java?
What is the difference between a checked and an unchecked exception?
Explain the difference between an object-oriented programming language and object-based programming language?
How to invoke external process in java.
Can we catch more than one exception in a single catch block?