thanks everyone.
i now see what's meant by 'command line args'.
 my understanding is that you are meant to pass the args to the
program at the time, and on the same line as when you invoke the
program, i.e; java programmName args.....


on a side note, i'm overly joyed and surprised by how quickly people
replied.

thanks again!

...ooostephen.


On Aug 5, 8:51 pm, Michèle Garoche <[email protected]> wrote:
> As the comments in the code says, the names come from the command line
> arguments.
>
> Michèle Garoche
>
> On Aug 6, 2:47 am, ooostephen <[email protected]> wrote:
>
> > what am i missing?
> > the sample code does not ask for any user input, yet it is supposed to
> > output three names; david charles young.  following the directions,
> > and cut'n pasting the code, i get the output expected, which is no
> > names.  where are the names coming from?
>
> > /////////////////////////////////////////////////////////////////////////// 
> > ////////
>
> > (1.1) Build and run Hello Java program that receives command-line
> > arguments
>
> > 1. Go to a directory where you want to create Java program
> > C:\>cd \myjavaprograms
>
> > 2. Write HelloCommandLineArguments.java using your editor of choice
> > such as notepad on Windows platform or gedit on Solaris platform (in
> > this example, I am using jedit) as shown in Code-1.10 below.
>
> > C:\myjavaprograms>jedit HelloCommandLineArguments.java
> > public class HelloCommandLineArguments {
>
> >     public static void main( String[] args ){
>
> >         // Print the string "Hello, " on screen
> >         System.out.println("I am saying Hello to the people below..
> > ");
>
> >         // Check if a command line argument exists
> >         if(args.length == 0)
> >             System.exit(0);
>
> >         // Display the arguments from the command line
> >         for(int counter = 0; counter < args.length; counter++){
> >             System.out.println("argument index " + counter + ": " +
> > args[counter]);
> >         }
> >     }
>
> > }
>
> > Code-1.10: HelloCommandLineArguments.java
>
> > /////////////////////////////////////////////////////////////////////////// 
> > //////////////////////////
>
> > results in this output
>
> > (1.1) Build and run Hello Java program that receives command-line
> > arguments
>
> > 1. Go to a directory where you want to create Java program
> > C:\>cd \myjavaprograms
>
> > 2. Write HelloCommandLineArguments.java using your editor of choice
> > such as notepad on Windows platform or gedit on Solaris platform (in
> > this example, I am using jedit) as shown in Code-1.10 below.
>
> > C:\myjavaprograms>jedit HelloCommandLineArguments.java
> > public class HelloCommandLineArguments {
>
> >     public static void main( String[] args ){
>
> >         // Print the string "Hello, " on screen
> >         System.out.println("I am saying Hello to the people below..
> > ");
>
> >         // Check if a command line argument exists
> >         if(args.length == 0)
> >             System.exit(0);
>
> >         // Display the arguments from the command line
> >         for(int counter = 0; counter < args.length; counter++){
> >             System.out.println("argument index " + counter + ": " +
> > args[counter]);
> >         }
> >     }
>
> > }
>
> > Code-1.10: HelloCommandLineArguments.java
>
> > 3. Compile HelloCommandLineArguments.java using javac compiler.
>
> > C:\myjavaprograms>javac HelloCommandLineArguments.java
>
> > 4. Run the HelloCommandLineArguments program using java command
> > passing arguments.
>
> > C:\myjavaprograms>java HelloCommandLineArguments David Charles Young
> > I am saying Hello to the people below..
> > argument index 0: David
> > argument index 1: Charles
> > argument index 2: Young
>
> > /////////////////////////////////////////////////////////////////////////// 
> > //////////////////
>
> > results in this output........
>
> > E:\Programming\Java Passion\basic\6_commandarguments>java
> > HelloCommandLineArguments
> > I am saying Hello to the people below..
>
>

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to