Advertisement
Guest User

JavaInputBoxDermot

a guest
Jan 26th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javafunwithdermot;
  7. import javax.swing.JOptionPane;
  8. /**
  9.  *
  10.  * @author Dermot
  11.  */
  12. public class User_Input {
  13.         public static void main(String[] args) {
  14.         try
  15.         {
  16.             String first_name, second_name;
  17.             first_name = JOptionPane.showInputDialog("Please Enter Your First Name");
  18.             second_name = JOptionPane.showInputDialog("Please Enter Your Second Name");
  19.             JOptionPane.showMessageDialog(null,
  20.                     "Your name is " + first_name + " " + second_name,
  21.                     "RESULT" , JOptionPane.INFORMATION_MESSAGE);
  22.             System.exit(0);
  23.         }
  24.         catch (Exception Ex)
  25.         {
  26.         JOptionPane.showMessageDialog(null,
  27.                 Ex.getClass() + "\n\nCause: " + Ex.getMessage() +
  28.                 "\n\nError came From Line # " + Ex.getStackTrace()[0].getLineNumber(),
  29.                 "ERROR" , JOptionPane.ERROR_MESSAGE);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement