Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- import javax.swing.JOptionPane;
- public class NamesDialog
- {
- //program that asks first. millde. and last name then displays greeting, use input boxes
- public static void main(String[] args)
- {
- //declare string variables
- String first, middle, last;
- //Initialize variables and ask user for input
- first = JOptionPane.showInputDialog("whats your first name?");
- middle = JOptionPane.showInputDialog("whats your middle name?");
- last = JOptionPane.showInputDialog("whats your last name?");
- //display the result
- JOptionPane.showMessageDialog(null, "greetings "+first+" "+middle+" "+last+"!");
- //close system down+
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement