CIS 4930 (Programming in Java):
Homework #0x

Assigned:
January 15, 1998.
No due date; not for credit.
Objective:
Practice some basics of Java syntax.
Part 1: "echo" program.
Write a stand-alone application (class Echo) that echoes its command-line arguments, each on a separate line. For example, called with
java Echo a b Here There
it should print:
a
b
Here
There
You'll probably find it useful to start from Homework #0b's "Hello World" application. Change the class name to Echo and make appropriate changes in the body of main.

Hints: Remember that the parameter passed to main is an array of strings, and that the println method takes a string as its parameter.

See Echo.java for a sample solution.

Part 2: "sum" program.
Write a stand-alone application (class Sum) that sums its command-line arguments (assumed to be integers) and writes the result to standard output. For example, called with
java Sum 1 2 3 4
it should print:
10
You should be able to start from your solution to Part 1.

Hints: Class Integer has a static method parseInt that takes a string argument and returns an integer; e.g., Integer.parseInt("10") returns 10.

See Sum.java for a sample solution.