PrintWriter Class
Package: java.io
The PrintWriter class lets you write data to an output stream. Although you can connect a PrintWriter to any object that implements Writer, you’ll use it most often in conjunction with a BufferedWriter object.
Constructors
|
Constructor |
Description |
|
|
Creates a print writer for the specified output writer. |
|
|
Creates a print writer for the specified output writer. If the second parameter is |
Methods
|
Method |
Description |
|
|
Closes the file. |
|
|
Writes the contents of the buffer to the hard drive. |
|
|
Writes the value, which can be any primitive type or any object. If the value is an object, the object’s |
|
|
Writes the value, which can be any primitive type or any object. If the value is an object, the object’s |
Creating a PrintWriter object
Creating a PrintWriter object to write data to an output file is a bit of a convoluted process that typically involves four distinct classes. First, you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
