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
Can list have duplicates in java?
Write a program to find the greatest of three numbers in java?
What is array size in java?
What is the final class?
What are "methods" and "fields"?
What is the default size of load factor in hashing based collection?
How can we make a class virtual?
What is string :: npos?
Does A Class Inherit The Constructors Of Its Superclass?
What is set string?
What is the symbol for line break?
What are the rules for naming an array?
How do you add spaces in java?
Can a class declared as private be accessed outside it’s package?
Is there any limitation of using inheritance?