Writing Text Files

This chapter explains Java's FileWriter class and how you can use it to store data in files.

1. 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 21 used redirection to write text files. Redirection is when output that would normally go to the monitor is sent to a disk file. The program has no control of this.

In this chapter your program creates a file and writes output to it.

Chapter Topics:

      • Class FileWriter
      • Creating a disk file
      • Closing a disk file
      • The write() method
      • Catching I/O exceptions
      • Class BufferedWriter


Question 1:

(Review: ) What is the ancestor class of all streams that do character-oriented output?

Source: Bradley Kjell, https://chortle.ccsu.edu/Java5/Notes/chap83/ch83_1.html
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 License.