No.
PrintWriter
The class PrintWriter
is used to
deal with the end-of-line problem and other frustrations
of file output.
PrintWriter
provides many methods that are
useful for "printing" characters.
("Printing" in this context means sending characters to an output destination,
not usually a hard-copy printer.)
The println()
method uses the
approprate line separator for the operating system the program is
running on.
Often a PrintWriter
stream is connected to a
BufferedWriter
stream which is connected to
a FileWriter
.
For small programs, where buffering is not needed,
the middle pipe (the BufferedWriter
)
can be omitted.
A further advantage of PrintWriter
is that
none of its methods (including println()
) throw exceptions.
Usually output is more reliable than input
(because the program has control over its output),
so exception handling is sometimes not needed.
Can a PrintWriter
be used alone?