java program to swap two numbers using bitwise xor operator

Solutions on MaxInterview for java program to swap two numbers using bitwise xor operator by the best coders in the world

showing results for - "java program to swap two numbers using bitwise xor operator"
Alma
06 Apr 2018
1import 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);}}