Originally posted by Jothi Shankar Kumar Sankararaj: Ok that is understandable that it will null the second reference. I want to know, won't it affect the reference from the main method?? Why not the reference from the main method be nulled???
Any thoughts on that?
Remember that Java always passes a copy of the reference to the method. So it is a local reference variable that is set to null. The confusion is caused by the fact that the name of the local reference variable (in the parameter list) is the same as the one in the main method, namely a1.