Have you ever felt the need of keeping the constructor private ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Have you ever felt the need of keeping the constructor private ?Design
Ans. Yes, When either we don't want an object to be created ( class having all static elements and hence not required ) or object to be created using a static method or static block. One such example could be a situation when we would like app to load objects at start up and we would like to restrict new object creation by any request.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     private constructor  constructor


Related Questions

  Can we instantiate the object of derived class if parent constructor is protected ?
 Can a constructor have a private access specifier ?
  Can we instantiate the object of derived class if parent constructor is private ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: