Hi Everyone,
Please assist with the below question
- Write a Java program to:
1.1 Store three numbers into variables num1, num2 and num3 and then display those numbers in a dialog box.
1.2 When the OK button of the dialog is pressed, the program should swap the values in the three variables, such that num1 holds the value which was in num2, num2 holds the value which was in num3, and num3 holds the value which was in num1. Hint: used a fourth variable called temp to temporarily store numbers during the swop.
This is what I have done so far, just need help with the fourth variable.
This is what I have done so far.
*import javax.swing.JOptionPane;*
*public class NumberSwop*
*{*
* public static void main(String [] args)*
* *
* {*
* int num1;*
* int num2;*
* int num3;*
* int temp;*
* *
* *
* num1 = 10;*
* num2 = 80;*
* num3 = 15;*
* *
* String numString1; *
* String numString2;*
* String numString3;*
* *
* JOptionPane.showMessageDialog(null, "10");*
* JOptionPane.showMessageDialog(null, "80");*
* JOptionPane.showMessageDialog(null, "15");*
* *
* System.exit(0);*
* }*
*}*