Created
September 11, 2017 10:28
-
-
Save JayadevSenapathi/e09d7fec7750f3bb32e155ccbc64c75e to your computer and use it in GitHub Desktop.
A sample Java program using GUI with javax.swing package.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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