what is the use of declaring constructor as private?

Answer Posted / ravikiran

In order to restrict the class to get subclassed

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a module function?

560


Can you create an object of an abstract class?

555


Can we use string in the switch case?

579


List implementations of list interface?

566


State the main difference between c++ and java?

594






What is native code?

539


What is Hierarchy of exception?

650


What is an interoperable application in java ?

587


What is the purpose of the enableevents() method?

587


Does list allow duplicates in java?

522


What is variable explain with example?

574


What does the exclamation mark mean in java?

596


Why do we need data structure in java?

577


How do you create a null object?

515


What will be the output of round(3.7) and ceil(3.7)?

683