Create a java file to show "Hello World!" on a window:

1. Type (or copy) the following program on Notepad.

import javax.swing.JOptionPane;

public class DialogViewer
{
   public static void main(String[] args)
   {
 	JOptionPane.showMessageDialog(null, "Hello, World!");
 	System.exit(0);
   }
}
2. Save the file as DialogViewer.java in the hello folder of your USB flash drive.
3. Go to Command Prompt and locate your folder.  Compile and run the file.
    You will see the following:
		

Create another java file to get user's information from a window:

Type (or copy) each of the following programs on Notepad.  Also, compile & run the program to see what difference they have.

import javax.swing.JOptionPane;

public class UserInterface
{
   public static void main(String[] args)
   {
 	String name = JOptionPane.showInputDialog("Enter your name:");
 	JOptionPane.showMessageDialog(null, "Nice to meet you, " + name + "!");
 	System.exit(0);
   }
}

import javax.swing.JOptionPane;

public class UserInterface
{
   public static void main(String[] args)
   {
 	String name = JOptionPane.showInputDialog("Enter your name:");
 	System.out.println("Nice to meet you, " + name + "!");
 	System.exit(0);
   }
}