Consider the following Java program:
import java.lang.*;
public class SecondProgram {
public static void main ( String args[] ) {
if (args.length > 0) {
System.out.println("Hello " + args[0]);
} else {
System.out.println( "Hello everybody!");
}
}
}
PART 1.
Modify the program such that if there are no command line arguments, when you type:
java SecondProgram
It should give:
Hello everybody!
PART 2:
If there are command line arguments (names) then it will print Hello to all the names with one name printed per line (along with the number of the name):
When you type:
java SecondProgram Helen Armen Joseph
You should get:
Hello
1. Helen
2. Armen
3. Joseph