Java Program to Swap 2 Numbers Using 3rd Variable

In this program we will write a Java program Perform Swapping of 2 numbers using 3rd Variable. We will swap values of 2 Integer variables using a 3rd Temporary Variable.

Java program to swap two numbers –
Enter x and y
4 5
Before Swapping
x = 4
y = 5
After Swapping
x = 5
y = 4
Watch it on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *