17-SequentialFiles

17-SequentialFiles - Chapter XVII Input/Output with...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter XVII Input/Output with Sequential Files Chapter XVII Topics 17.1 Introduction 17.2 Different Types of Files 17.3 Using the File Class 17.4 Files of Character Strings 17.5 Files of Numbers 17.6 A Note About the Scanner Class 17.7 Summary Chapter XVII Input/Output with Sequential Files 885 17.1 Introduction Random Access Memory ( RAM ) is great while it lasts, but it is only temporary. Rebooting the computer, flipping the power switch, tripping over the power cord and enjoying a friendly electrical storm can quickly delete or corrupt the information stored in your computer’s dynamic memory. Long ago, you became familiar with the solution to this problem. Use external storage to permanently store any important information. Most students learn several lessons about the virtue of saving their work on a regular basis. Common software programs like word processors, spreadsheets, and program languages, like Java, create user data files that are stored externally. This means that the program you write is in fact a data file of another program. This may seem odd. You probably are comfortable thinking that a word processing document is stored as a data file. However, the programs you have written seem like programs, not data files. Both are true simultaneously. You have written fully functional Java programs. At the same time, the programs you have written were data files of some text editor program, like Notepad or a special Integrated Development Environment ( IDE ) program, JCreator. Perhaps it has happened to you that the bell rang in the middle of entering data for your program. Or you went to work, to band practice - who knows where - and all the data you entered will need to be entered once more the next time when you return to your computer. Would it not be nice if your program’s data could be stored in the same manner as the program itself? Program languages in general - and Java specifically - have the ability to create their own data files. This means that data entered by a program user can be stored for future processing. It also means that data only needs to be entered once. In some cases, data never needs to be entered. It is quite possible that your teacher, or somebody else, has created a data file of information. It becomes your job to retrieve that information in your program and process the data. This approach is very convenient and used quite extensively in college computer science classes. Many computer science courses teach data entry with files quite early, precisely because it is so convenient. I have not used that approach. Personally, I prefer to introduce file handling at a time when I think you have the necessary tools to handle the topic properly. You will find that input/output processes in Java are hardly a trivial task....
View Full Document

{[ snackBarMessage ]}

Page1 / 31

17-SequentialFiles - Chapter XVII Input/Output with...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online