Aries said:
Hello, i am new to programming.Here is a simple exercise: Write
a simple class that iterates through all the arguments passed
in on the command line and prints them out to the screen. If no
arguments are specified print a message explaining to the user
that they need to supply some arguments.
Could u help me pls...
Can you write a program that prints "Hello, world!" no matter
what? Write that first. The command to print "Hello, world!" is
spelled System.out.println("Hello, world!");.
Then modify the program so that it prints "Hello, world!" if
there are command line arguments, and prints another message
otherwise.
When you have done that, you know how to write a runnable program
and how to run it, and you also know where to find the command
line arguments and how many they are, and how to choose what to
do based on a condition being true or false.
Now modify the program to print out the first command line
argument, if there are command line arguments. Print a message
otherwise.
When you have done that, you know how to access individual
command line arguments. You have found out that the index of the
first argument in the array - they are in a thing that is called
an array - is 0.
Then you are ready to learn about loops. First modify the program
to print out the first command line argument as many times as
there are command line arguments: print huuh huuh huuh, each on
its own line, if the arguments are huuh, ka and ja. Use a so
called "for" loop. If it takes an hour to understand how it
works, spend the hour.
At this point it is really simple to finnish the job and let the
huuhkaja out of its cage. Typically you change a single character
only: a zero to ... what?