Page 925 - AP Computer Science A, 7th edition
P. 925
20. (B) The swap method has just a single IntPair parameter, which eliminates segment I. Segment III fails because setFirst and setSecond are used incorrectly. These are mutator methods that change an IntPair object. What is desired is to return the (newly swapped) first and second values of the pair: Accessor methods getFirst and getSecond do the trick. To see why this swap method works, look at the memory slots.
Before the swap method is called:
Just after the swap method is called:
Just before exiting the swap method: