what is the use of private constructor in core java?

Answer Posted / deep chandra harbola

private constructor are used to create Sinleton class.
example logger class
for singleton class only one object can be created.
by default member of singleton class are static.
singleton class can not be inherited.

Is This Answer Correct ?    29 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why arraylist is used in java?

783


Explain all java features with real time examples

1458


What is the do while loop syntax?

793


How do you start a new line in java?

750


What does s mean in regex?

790


What exactly is java?

720


What is ternary operator in java?

831


How does hashmap work in java ?

763


How do you override a method in java?

767


What is string pool?

840


What is a cup of java?

807


What are the benefits of java?

808


What is a jagged array in java?

796


What is the difference between abstract class and interface1? What is an interface?

803


Does sprintf add a null terminator?

849