MyGreet.java

Download MyGreet.java

 1: // MyGreet.java - Shows use of command line arguments to
 2: // display a personalized friendly greeting!
 3: // Written by Wayne Pollock, Tampa, FL USA, 1999
 4: 
 5: class MyGreet
 6: {
 7:    public static void main ( String [] args )
 8:    {
 9:       if ( args.length == 0 )
10:          System.out.println( "Hello, stranger!" );
11:       else
12:          System.out.println( "Hello, " + args[0] + "!" );
13:    }
14: }