This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am learning this stuff starting from C where the way you thought swap should work is reasonable. In Java, I think you have to take a different approach. This may be overly simplistic, but maybe someone will benefit from it (This is the "beginner" section after all):
The output is:
x = 1 y = 2 x = 2 y = 1 x = 5 y = 8 x = 8 y = 5
I thought there should be a way to use the Integer class to do exactly what you suggested. Java is all 'pass by value', but what gets passed for an object is it's reference since objects are all reference variables. This didn't work as I expected - more to learn I guess...