Input File for this Program

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Just one.

Input File for this Program

The program will not read any more data than it has been written to deal with. Of course, the program could be written to read more than one line of data.

Here is an example input file, named input.txt.

This is line one of the file.
This is line two of the file.
The last line of the file.

Here is what the above program does when input.txt is redirected to it as input:

C:/users/default/JavaLessons>java Echo < input.txt

Enter your input:
You typed: This is line one of the file.

C:/users/default/JavaLessons>

QUESTION 4:

  • How many lines are in the file?
  • How many lines is the program written to read?
  • How many lines did the program read?