CHAPTER 83 — Writing Text Files



created: June 6, 2000; revised: July 7, 2002, June 8, 2003

CHAPTER 83 — Writing Text Files

This chapter explains how to create a text file
on the hard disk and how to write character data
to it.

Chapter Topics:

  • Class FileWriter.
  • Creating a disk file.
  • Closing a disk file.
  • The write() method.
  • Catching IO exceptions.
  • Class BufferedWriter.

In a previous chapter you used
command line redirection
to write text files.
This told the operating system to
create a file and to send your program’s output to it.
In this chapter your program has control of file creation and
writes output to it.

QUESTION 1:


What is the ancestor class of streams
that do character-oriented output?