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.)
println() method uses the
approprate line separator for the operating system the program is
PrintWriter stream is connected to a
BufferedWriter stream which is connected to
For small programs where buffering is not needed
the middle pipe (the
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.