We have seen how to get data to and from the console via output and input streams. The next step in our exploration of input and output streams is to be able to access a persistent storage mechanism, one where we can save our data, exit the program, and then use it later. Data stored persistently, from one invocation of a program to the next, is saved in a file via standard file operations. Persistently stored data—that is, files—not only exists from one program invocation to the next but also remains in existence after the computer is turned off and then restarted.
In persistent storage, files are the basic entity of storage. In this chapter, we will present the essential properties of files and some basic manipulations ...