Skip to content

Instantly share code, notes, and snippets.

@JayadevSenapathi
Created September 11, 2017 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayadevSenapathi/e09d7fec7750f3bb32e155ccbc64c75e to your computer and use it in GitHub Desktop.
Save JayadevSenapathi/e09d7fec7750f3bb32e155ccbc64c75e to your computer and use it in GitHub Desktop.
A sample Java program using GUI with javax.swing package.
import javax.swing.*;
public class GUIInput {
public static void main(String[] args) {
String name = JOptionPane.showInputDialog("What's your name?");
String ageString = JOptionPane.showInputDialog("What's your age?");
int age = Integer.valueOf(ageString);
System.out.print("Hello " + name);
System.out.println("You are going to be " + (age + 1) + " next year");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment