INTRODUCTION TO COMPUTER SCIENCE
Robert Sedgewick and Kevin Wayne


This is the syntax highlighted version of HiThree.java.

/*************************************************************************
 *  Compilation:  javac HiThree.java
 *  Execution:    java HiThree name1 name2 name2
 *  
 *  Prints "Hi, Carol, Bob, and Alice." where "Alice", "Bob", and "Carol"
 *  are the thre command line parameters in order.
 *
 *  % java Hi Alice Bob Carol
 *  Hi, Carol, Bob, and Alice.
 *
 *  % java Hi Carol Bob Alice
 *  Hi, Alice, Bob, and Carol.
 *
 *************************************************************************/

public class HiThree { 

   public static void main(String[] args) { 
        System.out.print("Hi, ");
        System.out.print(args[2]);
        System.out.print(", ");
        System.out.print(args[1]);
        System.out.print(", and ");
        System.out.print(args[0]);
        System.out.println(".");
   }

}


Last updated: Wed Feb 11 18:07:23 EST 2004 .
Copyright © 2004, Robert Sedgewick and Kevin Wayne.