10.5. Passing Reference Values

If reference values are passed as actual parameter, the reference value stored in the actual parameter is passed. This means both actual parameter and formal parameter are the handles to same object.So changes made to the object via the formal parameter will be get reflected on the object state after the call returns.

In other words, if an Object reference is passed as an argument, then a copy of the object reference is sent to the called method. This means that both the object reference in the calling program and copy of object reference sent to the called method are pointing to the same object.

Remember object aliases, we learnt earlier. In this case the object reference in the calling program and the copy of object reference sent to the called method are object aliases.

So if the called method changes the state/value of the object, it is reflected calling program.

		// Example Code here