posted 20 years ago
When you call the another() method you are passing a copy of your reference to the original object, rather than the actual reference variable. Thus, when you do v=vh in your method you are only pointing the local method variable (declared in the method signature) to point to the new object.
Compare this with the following code:
Again, the parameter will be a copy of the int passed to the method, rather than the actual int variable, so the value of the variable in main() will not be changed.
Admit nothing. Blame everyone. Be bitter.