// Swapping example using third variable
class Swap
{
public static void main( String args[ ] )
{
int a, b, t;a = 10;
b = 20;
System.out.print( "\nBefore Swapping :" );
System.out.print( a + " " + b );t = a;
a = b;
b = t;
System.out.print( "\nAfter Swapping : " );
System.out.print( a + " " + b );
}
}
Output:Before Swapping : 10 20
After Swapping : 20 10