MyGreet.java

Download this MyGreet.java source file


// MyGreet.java - Shows use of command line arguments to
// display a personalized friendly greeting!
// Written by Wayne Pollock, Tampa, FL USA, 1999

class MyGreet
{
   public static void main ( String [] args )
   {
      if ( args.length == 0 )
         System.out.println( "Hello, stranger!" );
      else
         System.out.println( "Hello, " + args[0] + "!" );
   }
}