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
- 2
- 1414
Showing Answers 1 - 2 of 2 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.