CHAPTER 24 — File Input Techniques

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 home page   go to next page        

created: 01/16/99; revised: 01/20/00, 07/13/02, 05/23/03, 03/22/06

CHAPTER 24 — File Input Techniques

Most programs read their data from one or more files and write their results to one or more files. Usually interaction with the user is done only to specify details of the processing, such as the names of the files. This chapter discusses some useful techniques for processing data from an input file.

Chapter Topics:

  • Three types of input loops
  • Counting input loops
  • Several groups of data in one file
  • Sentinel controlled input loops

The programs in this chapter read and write disk files using Scanner and PrintStream as described in Chapter 23.

QUESTION 1:

(Not again!) What are the three types of loops?