Take 2 classes.i.e., Class A,Class B.In Class B declare constructor as Private.But I have to access Class A using the constructor in Class B.How is it possible?One interviewer told that Through getInstance() method it's possible to access Class A.eEven Class B declare as Private.How is it possible?Explain with an example.
-
Interview Candidate
- Oct 1st, 2006
- 4
- 1422
Showing Answers 1 - 4 of 4 Answers
Take 2 classes.i.e., Class A,Class B.In Class B declare constructor as Private.But I have to access Class A using the constructor in Class B.How is it possible?One interviewer told that Through getInstance() method it's possible to access Class A.eEven Class B declare as Private.How is it possible?Explain with an example.