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 we convert list to set in java?
Is there is any difference between a scrollbar and a scrollpane?
What are namespaces in java?
What do you mean by of string::valueof expression in java 8?
How do listeners work?
What are the advantages of java?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
What are the Static and Dynamic Variables? Differentiate them.
How to find the largest value from the given array.
How do you invoke a method?
Explain notifyall() method of object class ?
What is class forname used for?
Can we pass a primitive type by reference in java? How
What is the preferred size of a component in java programming?
What is difference in between java class and bean?