Java Program to Swap two Numbers - The Coding Shala
Home >> Java Programs >> Swap Two Numbers
In this post, we will learn How to Swap Two Numbers in Java.
Swap Two Numbers in Java
We have to write a Java program to swap the values of the given two numbers.
num1 = 20
num2 = 10
Using temporary variable.
Without using a temporary variable.
Other Posts You May Like
- Add Two Numbers in Java
- Java Program to find Sum of Digits of a Number
- Count Negative Numbers in Sorted Matrix
- Compare Two Strings by Ignoring whitespaces
- How to Reverse a String in Java