what is private constructor?what are the uses of writing
private constructor in our program?
Answer Posted / christian
a common use for a private constructor is to implement the
singletton pattern, which uses a public member variable of
the same type of the class which is defined. A public
getInstance() method uses this private constructor
Is This Answer Correct ? | 13 Yes | 6 No |
Post New Answer View All Answers
What is considered an anti pattern?
Give a brief description of java socket programming?
Explain the use of volatile field modifier?
What happens if an exception is throws from an object's destructor?
What is the use of coding?
How define set in java?
What is difference between fail-fast and fail-safe?
What is use of static method?
Explain the pointers in Java?
What is the difference between menuitem and checkboxmenu item?
What is private static class in java?
What is difference between length and length() method in java ?
What are the differences between heap and stack memory in java?
Is char a method in java?
How do you calculate roots in java?