Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Hour 20. Reading and Writing Files

There are numerous ways to represent data on a computer. You have already worked with one by creating objects—an object includes data in the form of variables and references to objects. It also includes methods that use the data to accomplish tasks.

To work with other kinds of data, such as files on your hard drive and documents on a Web server, you can use the classes of the java.io package. The "IO" part of its name stands for "input/output" and the classes are used to access a source of data, such as a hard drive, CD-ROM, or the computer's memory.

You can bring data into a program and send data out by using a communications system called streams, or objects that take information from one place to another.

During this hour, you will work with streams to do each of the following:

Share ThisShare This

Informit Network