Description:
Swap two numbers using a temporary variable.
Swap two numbers using a temporary variable.
Java Code
public class SwapNumbers {
public static void main(String[] args) {
int a = 5, b = 10, temp;
temp = a; a = b; b = temp;
System.out.println("a = " + a);
System.out.println("b = " + b);
}
}
Expected Output
a = 10
b = 5