JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Mar 13, 2004
The original question said:
Here how should i call Test's method without using referance & also the function of both should be same means (return type & parameters both should same)
I took "without using reference" literally and I didn't use t1, the only reference provided.
Of course, any method invocation involves some sort of reference, but my solution did not create a reference variable.
If you take "without using reference" to mean without creating a new reference and you take "the function of both should be same means (return type & parameters both should same)" to mean that you can't change classes Test and Test1, then I think the problem is unsolvable.
We could further discuss what the interviewer quoted by the the interviewee really meant, but that's not a Java discussion.