what is the use of declaring constructor as private?

Answer Posted / ranganathkini

By making all the constructors of a class private, you can
also prevent other class from extending the class without
marking the class final.

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is dependent variable?

498


What is difference between hashset and hashmap in java?

468


What is difference between null and void?

535


How do you compare two strings lexicographically?

543


Can a class be declared as static?

683






If you are given the name of the function at run time how will you invoke the function?

690


How do you sort a string in java?

541


Explain the difference between abstract class and interface in java?

541


What is the difference between stringbuffer and stringbuilder class?

577


How will you add panel to a frame?

650


explain multi-threading in java?

561


Write a program based on Java script program.

652


What is a singleton factory?

514


What is the use of http-tunneling in rmi?

555


What is difference between == and === in js?

551