193030

Simple GUI

Mar 5th, 2021 (edited)
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class GuiBasics {
  3.  
  4.     public static void main(String[] args) {
  5.        
  6.         String name  = JOptionPane.showInputDialog("Enter your name");
  7.         JOptionPane.showMessageDialog(null,"Hello "+name);
  8.        
  9.         int age = Integer.parseInt(JOptionPane.showInputDialog("Enter your age"));
  10.         JOptionPane.showMessageDialog(null,"You are  "+age+ " years old.");
  11.        
  12.         double height = Double.parseDouble(JOptionPane.showInputDialog("Enter your height"));
  13.         JOptionPane.showMessageDialog(null,"You are  "+height+ " cm tall.");
  14.        
  15.     }
  16.  
  17. }
  18.  
Add Comment
Please, Sign In to add comment