// StringEqualityDemo.java

import javax.swing.JOptionPane;

public class StringEqualityDemo
{
   public static void main(String[] args)
   {
      String line = JOptionPane.showInputDialog(
                       "Type anything, or nothing:");

      if ( line == null )
         System.out.println("You clicked CANCEL.");
      else if ( line == "" )
         System.out.println("This message will never be printed.");
      else if ( line.equals("") )
         System.out.println(
               "You clicked OK without typing anything");
      else
         System.out.println("You typed: " + line);

      System.exit(0);
   }  // method main
}  // class StringEqualityDemo