// illustrate how to put up message and input dialog import javax.swing.*; public class dialogs { public static void main(String args[]) { String fn, sn; int n1, n2, sum; fn = JOptionPane.showInputDialog("Enter first number:"); sn = JOptionPane.showInputDialog("Enter second number:"); n1 = Integer.parseInt(fn); n2 = Integer.parseInt(sn); sum = n1 + n2; JOptionPane.showMessageDialog(null, "Sum of numbers = " + sum, "SUM VALUE", JOptionPane.PLAIN_MESSAGE); System.exit(0); } }