// StringCompareDemo.java

public class StringCompareDemo
{
   public static void main(String[] args)
   {
      if ( args.length < 2 )
      {
         System.out.println("Two command-line arguments needed.");
         System.exit(1);
      }  // if

      if ( args[0].compareTo(args[1]) < 0 )
          System.out.println(args[0] + " < " + args[1]
                              + " (i.e. the first word"
                              + " precedes the second word)");
      else if ( args[0].compareTo(args[1]) > 0 )
          System.out.println(args[0] + " > " + args[1]
                              + " (i.e. the second word"
                              + " precedes the first word)");
      else  // if ( args[0].compareTo(args[1]) == 0 )
          System.out.println(args[0] + " == " + args[1]
                              + " (i.e. the first word"
                              + " equals the second word)");
   }  // method main
}  // class StringCompareDemo