swap « Integer « Java Data Type Q&A





1. Is there a way to code re-factor swapping integers    stackoverflow.com

We have this code in many places where we swap integers if one value is higher than the other. Is there a way to re-factor this code, so it can be ...

2. how to swap two integers inside a function ?    coderanch.com

hi, i have a function which takes two Integer's .the int values of them should be swapped when i return from the fn. i tried doing Integer temp = i; i =j; j=temp. inside the fn. but when i come out and check the intValues()'s , they are not swapped. could some one pls help me out ? thanks --lg.

4. Swapping of two Integer Variables !!! Very Strange !!!!!    forums.oracle.com

It's swapping them correctly in the method "swap." And printing them correctly... I think you're confused in the second System.out.println you have. It's printing the assigned values of a and b in main. (They are never changed) So it swaps them correctly in main, but the instance variables in the main method are never swapped.