Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| |||||||||||
Core Java - Interview Questions and Answers for 'Private constructor' - 4 question(s) found - Order By Newest | |||||||||||
| |||||||||||
Ans. Yes, as protected constructor is accessible in sub class. | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() | |||||||||||
| |||||||||||
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. | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() | |||||||||||
| |||||||||||
Ans. Yes, declaring a constructor private means disabling the creation of object that way using new operator. | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() | |||||||||||
| |||||||||||
Ans. No | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() | |||||||||||
| |||||||||||