Please send questions to st10@humboldt.edu .

/**
 * another VERY simple Java application that lets us
 * investigate main()'s argument args; it now echoes
 * the arguments to the screen, BUT it MUST have exactly
 * THREE arguments. Else it complains and halts. 
 *
 * by: Sharon M. Tuttle
 * last modified: 1-29-01
**/

public class ArgsPlay3
{
        public static void main(String args[])
        {
                System.out.println("Hello, world");

		// if there AREN'T three arguments, complain and exit
		if ((args == null) || (args.length != 3))
		{
			// printing error message to wherever an
			// error message is supposed to go
			System.err.println("Usage: java ArgsPlay3 "
				+ "arg1 arg2 arg3");
			
			// exit the application
			System.exit(0);
		}


		System.out.println("This call used "
				   + args.length
				   + " arguments.");
		
		// if there are any arguments, print them to
		// the screen, one line at a time
		for (int i=0; i < args.length; i++)
		{
			System.out.println("args[" + i 
				+ "]: " + args[i]);
		}

        }
}