This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The rule is that we cannot change the reference of an object but the object can be changed.In the method, a copy of the reference variable is passed so its changing the reference of that copy and not the actual reference.
You seem to be surprised by the output. Why don't you describe here what you were expecting? That would make it easier to spot were you possibly went wrong in your reasoning. It would also be a good learning experience. [ August 22, 2006: Message edited by: Ulf Dittmer ]