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
Is java a digit method?
Which number is denoted by leading zero in java?
What is hashtable and explain features of hashtable?
Can a abstract class be defined without any abstract methods?
What is a lambda expression ? What's its use ?
Can list be null in java?
What is nested loop? What is dangling else condition in it?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
Explain about main() method in java ?
What are reference variables in java?
What are bind parameters?
What is return null in java?
Can substring create new object?
What do you understand by java?
What is exception in java?