what is private constructor?what are the uses of writing
private constructor in our program?

Answer Posted / neha

we can not create instance of object with new operator.if u
do not want the class to be inherited then we declare the
construtor as private when we used Private Construtor
Static metods are used this construtor are also used for
creating singleton object

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between string and stringbuffer?

695


What are benefits of java?

783


What is the function of character?

752


Can we create a class inside a class in java?

736


What is meant by singleton class?

783


What is the difference between a method and a function in alice?

795


What are the different ways of implementing thread? Which one is more advantageous?

735


How do you identify if jvm is 32-bit or 64-bit from java program?

721


How do you add spaces in java?

721


How do you sort in ascending order in java?

666


What is use of static method?

744


What is a method signature java?

793


Can we override the static methods?

761


How are variables stored?

721


Why Java doesn’t support multiple inheritance?

809