February 2017
Beginner
1056 pages
28h 57m
English
Proper words in proper places,
make the true definition of a style.
—JONATHAN SWIFT, Letter to a Young Clergyman (January 9,1720)
In this section, we give a description of the most common ways to perform text-file I/O in Java.
The class PrintWriter in the Java Class Library defines the methods that we will need to create and write to a text file. This class is the preferred one for writing to a text file. It is in the package java.io, so we will need to begin our program with an import statement. Actually, we will be using other classes as well, so we will import them also, as you will see soon.
Before we can write to a text file, we must connect it to an output stream. That is, we open the file. To do ...
Read now
Unlock full access