what is private constructor?what are the uses of writing
private constructor in our program?
Answer Posted / nandhakumar
We use private constructor in singleton class:it ve only one
instance,in this case we generally used to ve one static
method (getInstance()).While we cal this method first time
it use private constructor to create instance.next time this
method returns the existin instance..
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which java version is latest?
Why do we need hashmap in java?
Can an interface extend another interface?
Can you explain the private protected field modifier?
Is singleton thread safe in java?
Is age discrete or continuous?
Is void a return type?
What is a class reference?
Why parsing is done?
What is the use of put method?
define polymorphism in java
What is space character in java?
What data type is string java?
What is hasnext in java?
What is abstract class? Explain