How To Use JOptionPane.showInputDialog In Java
__________________________________________________________________package JavaDB_001;
import javax.swing.*;
public class Project {
public static void main(String[] args){
String num1,num2;
int sum;
//get the first number fom showInputDialog
num1 = JOptionPane.showInputDialog("Enter The First Number");
//get the Seconde number fom showInputDialog
num2 = JOptionPane.showInputDialog("Enter The Seconde Number");
//verify the inout is not null
if(num1 == null){
num1 = "0";
}
if(num2 == null){
num2 = "0";
}
sum = Integer.parseInt(num1) + Integer.parseInt(num2);
JOptionPane.showMessageDialog(null, "The Sum Of this Two Number Is: "+sum);
System.exit(0);
}
}