Writer

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Writer

Writer

(Review: ) IO streams are either character-oriented or byte-oriented. Character-oriented IO has special features for handling character data. Byte-oriented IO is for all types of data (including characters, if you want). This chapter shows character-oriented output to a disk file using a Writer stream.

IO hierarchy

What class can used for writing characters to a file? You know that the class will descend from Writer. If you do not know what class you need, you could look under Writer in the Java documentation. (Or you could search the Web.)

QUESTION 2:

Does the class FileWriter seem like a likely candidate?