October 4, 2012 / IST / Language.

GUI program to show basic input using a dialog box.

import javax.swing.JOptionPane;
public class MP2
{
 public static void main(String args[])
 {
  String hobby=JOptionPane.showInputDialog("What is your hobby?");
  String message=String.format("Hi i am Piyush and my hobby is %s",hobby);
  JOptionPane.showMessageDialog(null,message);
 }
}