A good answer might be:

C:\users\default\JavaLessons>java MultiEcho < input.txt > output.txt

D:\users\default\JavaLessons>

Redirecting both Input and Output

Input and output redirection can be used simultaneously. Here is an example run of the program:

C:\users\default\JavaLessons>java MultiEcho < input.txt > output.txt

C:\users\default\JavaLessons\chap16d>type output.txt
Enter line1:
You typed: This is line one,
Enter line2:
You typed: this is line two,
Enter line3:
You typed: this is line three,
Enter line4:
You typed: this is line, uh... four,
Enter line5:
You typed: and this is the last line.
D:\users\default\JavaLessons\chap16d>

The order on the command line does not matter:

C:\users\default\JavaLessons>java MultiEcho > output.txt < input.txt

C:\users\default\JavaLessons>
You can have only one input file redirected to a program and one output file redirected from a program.

QUESTION 7:

(Review Question: ) How have our Java programs been reading numerical data?

Click Here after you have answered the question