Swaping Two Number

SwapingTwoNumbers
public class SwapingTwoNumbers{
 public void swapNumbers(int a,int b)
 {
  System.out.println("Before swapping A and B is :: "+a+"  "+b);
  a=a^b;
  b=a^b;
  a=b^a;
  System.out.println("After swapping A and B is :: "+a+"  "+b);
 }
}

Reactions

Post a Comment

0 Comments