Standard Swap problem

public class SwapVariables
{
public static void main(String args[])
{
int a=5;
int b= 6;

System.out.println(“Before Swap :”+a+” “+b);

a=a+b;
b=a-b;
a=a-b;

System.out.println(“After Swap :”+a+” “+b);

}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.