/*
 * File: p02.java
 *
 * Description:  This example program will take any incoming string
 *       and display it.  The point of this example is to present
 *       how Java uses basic input/output functionality.
 *
 * Modifications:  11/1/95 CValcarcel Created.
 *
 * NO WARRANTY, EXPRESSED OR IMPLIED, BLAH, BLAH, BLAH.
 *
 * THIS IS EXAMPLE CODE AND SHOULD NOT BE USED FOR ANYTHING
 * EXCEPT INSTRUCTIONAL PURPOSES.
 *
 */

//
// Let's change the name of our class as it will now be
// more generic.  Same rule applies about the implied
// "extends" ("extends Object" is implied).
//
class EchoString {
    public static void main( String args[] )
    {
        //
        // If only one arg comes in we want to print it without
        // a trailing blank so we print this solitary arg
        // if one actually exists.  This is a bit of overkill,
        // but examples shouldn't be too far off the mark.
        //
        if ( args.length > 0 )
            System.out.print( args[0] );

        //
        // I only need i in my for loop so I declare it
        // within the parens (similar to C++).  args is
        // an array so, by definition, its internal variable,           
        // length, contains its length (which equates to
        // the number of arguments.  No more argc!).
        //
        for ( int i = 1; i < args.length; i++ )
        {
            System.out.print( " " );   // Separate the arguments
            System.out.print( args[i] );
        }

        //
        // We do this because System.out will only flush on a newline
        // (don't believe me?  Look in Java/src/java/io/PrintStream.java.
        // the PrintStream autoflush variable is set to false
        // when the first constructor calls the second with an
        // autoflush argument of false).
        //
        System.out.println();
    }
}

