Java program to swap two numbers using bitwise xor operator code example
Example: Java program to swap two numbers using bitwise xor operator
import java.util.Scanner;public class Main {public static void main(String args[]){int m, n;Scanner s = new Scanner(System.in);System.out.print("Enter the first number");m = s.nextInt();System.out.print("Enter the second number");n = s.nextInt();m = m ^ n;n = m ^ n;m = m ^ n;System.out.println("After Swapping the number");System.out.println("First number:"+m);System.out.println("Second number:"+n);}}