Write a simple program to swap the numbers.

 Solution :- 

package mv;

public class SwapNumber {

public static void main(String[] args) {
int a=20;
int b=30;
System.out.println("Before swapping:a:"+a+",b:"+b);
int temp=a;
a=b;
b=temp;
System.out.println("After swapping: a:"+a+",b:"+b);

}

}

Comments

Popular posts from this blog

What are POJO classes in spring? What is the use of POJO Class, and How to create POJO classes.

How to create React project using command prompt?