what is the use of declaring constructor as private?

Answer Posted / ranganathkini

By declaring the class constructor as private, other classes
cannot create instances of the class.

This design is usually used in singleton patterns.

Is This Answer Correct ?    22 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is join () in java?

532


Is there any tag in htm to upload and download files?

612


I want to store more than 10 objects in a remote server? Which methodology will follow?

2638


What are the main uses of the super keyword?

559


Is array size fixed in java?

543






How can you say java is object oriented?

595


What is the difference between jfc & wfc?

599


What is the memory leak in java?

530


What is internal variable?

540


What do you mean by an interface in java?

574


What are the restrictions that are applied to the java static methods?

532


What is udp in java?

536


Tell me about your ability to work under pressure

1769


Give some features of interface?

586


What is command line used for?

594