Input box in java

Complete source code below will show you, how to create simple input box that will prompt some input from user. We will use predefined java class, JOptionPane to create simple input box. If you want your input box appear in a container, you can change null in source code below to target container.You can see example by click here.

*************************************************************************
COMPLETE SOURCE CODE FOR : JavaInputDialog.java
*************************************************************************


import javax.swing.JOptionPane;

public class JavaInputDialog
{
public static void main(String[]args)
{
//Pop up an input box with text ( What is your name ? )
String a=JOptionPane.showInputDialog(null,"What is your name ?");

//Print into command prompt what you put into input dialog box
System.out.println("My name is : "+a);
}
}


*************************************************************************
JUST COMPILE AND EXECUTE IT
*************************************************************************