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
Does .length start 0 java?
What is the structure of java?
Difference between ‘is-a’ and ‘has-a’ relationship in java?
Define max and min heap, also the search time of heap.
What happens if we don’t define serial version uid?
What is memory leak and how does java handle it?
Is nan false?
What are java packages?
What is float in java?
When is finally block not called?
Why doesn't the java library use a randomized version of quicksort?
What exceptions occur during serialization?
Is age discrete or continuous?
What is jdbc api?
What do heavy weight components mean in java programming?