what i want to make is when i make obj= null inside the method then it should reflect rObj also.
Well, I don't think that is possible... 'cause the parameter passing is by reference and not by actual object, so a change to reference in the obj will not reflect back to rObj... this will simply change obj's pointng direction to another direction which is null in this case.
@Yogesh: The point is that you can't set a method's parameter to null and expect it to be reflected in what called that method. Your code does the same thing your original code did, but with my wrapper object instead. The idea was to pass in the wrapper and set its *instance variable* to null, if that's what your usecase demands.
What, specifically, are you trying to do? All my solution does is solve the problem of needing to set something to null and have access to it later, it doesn't change the way Java works.
posted 10 years ago
That is the simplest of all !! but I guess Santosh would have complex logic implemented in that method .
I wasn't selected to go to mars. This tiny ad got in ahead of me: