Code Box
--------------------------------------------
/*program to swap two values using third variable */
import java.io.*;
class swap
{
public static void main(String x[]) throws IOException
{
int a,b,temp;
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\nEnter two numbers :");
System.out.print("\nEnter first number a= ");
a=Integer.parseInt(obj.readLine());
System.out.print("\nEnter second number b= ");
b=Integer.parseInt(obj.readLine());
System.out.print("\nValues before swapping a= "+a+" & b= "+b);
temp=a; //swapping
a=b;
b=temp;
System.out.print("\nValues after swapping a= "+a+" & b= "+b);
}
}

