Created: 01/14/99; revised: 08/13/99, 01/20/00, 07/13/02, 05/21/03, 03/19/06, 08/31/08, 11/25/10, 01/24/18, 05/28/23

go to home page   go to next page highlighting

CHAPTER 70 — Files and File Output

This chapter may be read after chapter 25.

Files are extremely useful because often the data for a program comes from files and often the results are stored in files. You already know about files. You have been creating and using files for your Java programs and their compiled byte files. (and probably in your other work, as well). This chapter discusses how to send the output of a program to a file.

The next chapter discusses how to read data from a file. For a full discussion of file I/O you will have to wait until later in these chapters.

However, AP Computer Science does not test file I/O. Most of the following chapters make little use of file I/O except in some programming exercises. It would be OK to skip this section and come back to it later.

Chapter Topics:

Almost all programs of any importance do massive amounts of input and output from and to disk files. File I/O is one of the most important parts of programming. The data that makes up this web page ultimately came from a disk file on a web server and was temporarily stored on several disk files on routers on its way to your computer, where it now resides on your disk. If you make a phone call, your digitized voice is repeatedly stored in files on its trip between you and your friend.


QUESTION 1:

What is a file? (Try to think of a one sentence definition.)


go to home page   go to next page