filmov
tv
Java Program To Swap Two numbers With Third Variable In Java | Java Practice Programs| Code Bode

Показать описание
#swapnumbers #javatutorial #javaprograms
Hi Guyz,
In This Video We will learn how to swap two numbers in java with a third variable.
public class NumberSwap {
public static void main(String[] args) {
// Swap two numbers using third variable
// 1. Take two input variables
// 2. Take a temp variable
// 3. assign number1 to temp
// 4. assign number2 to number1
// 5. assign temp to number2
// 6. Print two numbers
int temp;
temp=number1; //10
number1=number2; //20
number2=temp; //10
}
}
Other Playlist :
Eclipse Tutorial :
HTML Tutorial :
Java Learning Path :
HAPPY LEARNING!
Hi Guyz,
In This Video We will learn how to swap two numbers in java with a third variable.
public class NumberSwap {
public static void main(String[] args) {
// Swap two numbers using third variable
// 1. Take two input variables
// 2. Take a temp variable
// 3. assign number1 to temp
// 4. assign number2 to number1
// 5. assign temp to number2
// 6. Print two numbers
int temp;
temp=number1; //10
number1=number2; //20
number2=temp; //10
}
}
Other Playlist :
Eclipse Tutorial :
HTML Tutorial :
Java Learning Path :
HAPPY LEARNING!