Advertisement
thenewboston

Java Programming Tutorial - 50 - Graphical User Interface...

Aug 22nd, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. class apples {
  4.    public static void main(String[] args){
  5.      
  6.       String fn = JOptionPane.showInputDialog("Enter first number");
  7.       String sn = JOptionPane.showInputDialog("Enter second number");
  8.      
  9.       int num1 = Integer.parseInt(fn);
  10.       int num2 = Integer.parseInt(sn);
  11.       int sum = num1 + num2;
  12.      
  13.       JOptionPane.showMessageDialog(null, "The answer is " + sum, "the title", JOptionPane.PLAIN_MESSAGE);
  14.      
  15.    }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement