Java How ToSwap Two Variables
Swap Two Variables
Exchange the values of two variables using a temporary variable:
Example
int a = 5;int b = 10;int temp = a;a = b;b = temp;System.out.println("a = " + a + ", b = " + b);Explanation: We savea in a temporary variable, moveb intoa, and then move the saved value intob.

