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

Convert Binary tree to linked list.

580


What is the difference between dom and sax parser in java?

524


What are the major advantages of internal iteration over external iteration?

564


Difference between operator overloading and function overloading

601


What is method in research paper?

569






what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

515


What is the difference between arraylist and hashset in java?

512


How to split a string in java?

622


What are static variables and functions?

618


What are parameters in a method?

581


Describe what a thread-local variable is in java?

561


what is method reference in java 8?

550


What is method overloading in JAVA? Why is it not present in C ?

584


Can we catch more than one exception in a single catch block?

621


Are arrays immutable in java?

533