Question: What do you meant by private constructor? why somebody declare only private constructor.
Answer: One can delcare a private constructor for maintining the object creation ... maybe it just wants the object to be created once .... or maybe using a static method such as getInstance() one can give access to constructor which is private....Basically to control number of objects of classes
Question:
What do you meant by private constructor? why somebody declare only private constructor.
Answer:
One can delcare a private constructor for maintining the object creation ... maybe it just wants the object to be created once .... or maybe using a static method such as getInstance() one can give access to constructor which is private....Basically to control number of objects of classes Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
There should not be any Spelling Mistakes.
There should not be any Gramatical Errors.
Answers must not contain any bad words.
Answers should not be the repeat of same answer, already approved.
Answer should be complete in itself.
Related Questions
View Answer
Is java a fully object oriented programming or not? if not why?