The method swap fails to
swap the values of the actual parameters because,
in Java, all parameters are passed by value.
The invocation swap(a, b) results in the values
of the actual
parameters a and b
being copied into the formal parameters
x and y, respectively.
Then, within the body of
swap, the values of
x and y are interchanged,
and the method terminates. Upon termination, the new values of
x and y are not copied
back into the actual parameters. Consequently, the values of
the actual parameters are unaffected by the method.