what is the use of declaring constructor as private?

Answer Posted / anshul

A private constructor is a special instance constructor. It is commonly used in classes that contain static members only. If a class has one or more private constructors and no public constructors, then other classes (except nested classes) are not allowed to create instances of this class.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is char a method in java?

520


What does string intern() method do?

594


What steps are taken when the OS shifts from one-thread execution to another?

910


Is 0 a real number?

597


What do heavy weight components mean in java programming?

529






Does java arraylist maintain insertion order?

553


What is the byte order of byte buffer?

571


Explain what pure virtual function is?

603


What is the use of a conditional inclusion statement in Java ?

594


Is static a singleton?

527


What do you understand by the bean persistent property?

562


What is private static in java?

581


What do you mean by collectors in java 8?

546


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?

565


Convert a BST into a DLL and DLL to BST in place.

676