Advertisement
476179

names Dialog

Oct 10th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package lessons;
  2. import javax.swing.JOptionPane;
  3. public class NamesDialog
  4. {
  5. //program that asks first. millde. and last name then displays greeting, use input boxes
  6. public static void main(String[] args)
  7. {
  8. //declare string variables
  9. String first, middle, last;
  10.  
  11. //Initialize variables and ask user for input
  12. first = JOptionPane.showInputDialog("whats your first name?");
  13. middle = JOptionPane.showInputDialog("whats your middle name?");
  14. last = JOptionPane.showInputDialog("whats your last name?");
  15.  
  16. //display the result
  17. JOptionPane.showMessageDialog(null, "greetings "+first+" "+middle+" "+last+"!");
  18.  
  19. //close system down+
  20. System.exit(0);
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement