Swapping Two Variables || for loop || Java programs || java
In this, we are going to write a simple program to Swap Values of Two Variables in Java.
 


class Swapping
{
    public static void main(String[] args) 
    {
        int a = 15, b = 69, c;
        System.out.println("Before Interchange: a=" + a + " b=" + b);
        c = a;
        a = b;
        b = c;
        System.out.println("After Interchange: a=" + a + " b=" + b);
    }
}
#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post