Java, Java, Java
14. Files and Streams: Input/Output Techniques
OBJECTIVES
After studying this chapter, you will
Be able to read and write text files.
Know how to read and write binary files.
Understand the use of InputStreams and OutputStreams.
Be able to design methods for performing input and output.
Know how to use the File class.
Be able to use the JFileChooser class.
OUTLINE
Introduction
Streams and Files
Case Study: Reading and Writing Text Files
The File Class
Example: Reading and Writing Binary Files
Object Serialization: Reading and Writing Objects
From the Java Library: javax.swing.JFileChooser
Using File Data in Programs
Special Topic: Databases and Personal Privacy
Chapter Summary
Solutions to Self-Study Exercises Exercises
499
input and output
I/O streams
Figure 11.1: The System.out output stream connects your program to the screen and the System.in input stream connects it to the keyboard.