Input
Output
public class SwapWithTemp { public static void main(String[] args) { // Manually assigned numbers int num1 = 15; int num2 = 25; System.out.println("Enter the first number: " + num1); System.out.println("Enter the second number: " + num2); // Display original values System.out.println("Before swapping: num1 = " + num1 + ", num2 = " + num2); // Swap using a temporary variable int temp = num1; num1 = num2; num2 = temp; // Display swapped values System.out.println("After swapping: num1 = " + num1 + ", num2 = " + num2); } }