Methods and Parameters
Know
Java passes parameters by value. For a primitive the method gets a copy; for an object it gets a copy of the reference, so it can change the object but not repoint the caller variable.
Apply
Decide for each parameter whether the method can affect the caller, and trace accordingly.
Watch out
Expecting a method to change a caller’s int, or expecting reassigning an object parameter to affect the caller.
Study move
Write one method that fails to change an int and one that succeeds in changing an array, and explain the difference.
