Basics_Que_01

Home / Java Practice Question / Basics_Que_01

Basics_Que_01


WAP to swap two Number by using 3rd Variable....

Program : 

public class Basics{
public static void swap(int a , int b){

// Here temp is our 3rd variable
int temp=a;
a=b;
b=temp;

System.out.println("Value of a is : " + a);
System.out.println("Value of b is : " + b);
}

}