Java Program To Swap Two Numbers Without Temporary Variable import java.util.Scanner; class SwapNumbers { public static void main(String args[]) { int x, y; System.out.println("Enter x and y:"); Scanner n = new Scanner(System.in); x = n.nextInt(); y = n.nextInt(); System.out.println("Before Swapping:\nx = "+x+"\ny = "+y); x = x + y; y = x - y; x = x - y; System.out.println("After Swapping:\nx = "+x+"\ny = "+y); n.close(); }} Java Program To Swap Two Numbers Using Temporary Variable import java.util.Scanner; class SwapNumbers2 { public static void main(String args[]) { int x, y, temp; System.out.println("Enter x and y:"); Scanner n = new Scanner(System.in); x = n.nextInt(); y = n.nextInt(); System.out.println("Before Swapping:\nx = "+x+"\ny = "+y);