Monty374

Name and Age

Sep 19th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package swing;
  2.  
  3. import javax.swing.JOptionPane;
  4.  
  5. /**
  6. *
  7. * @author Monty
  8. */
  9. public class Swing {
  10.  
  11. /**
  12. * @param args the command line arguments
  13. */
  14. public static void main(String[] args) {
  15. String name = JOptionPane.showInputDialog("What is your name?");
  16. String input = JOptionPane.showInputDialog("How old are you?");
  17. int age = Integer.parseInt(input);
  18. System.out.print("Hello, " + name + ". ");
  19. System.out.println("Next year, you'll be " + (age +1));
  20. System.exit(0);
  21.  
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment