Possible Duplicate:
PrintWriter and PrintStream never throw IOExceptions
Maybe the question is a bit “strange”. But i’m curious to know why both PrintWriter and PrintStream don’t check automatically runtime exceptions , and they provides a checkError() method.
Thanks to all in advance.
For PrintStream which is often writing to std out or err, these stream might have been closed or discarded but you don’t want the program to fail unexpectedly as a results.
PrintWriter is in many ways the Writer version of PrintStream, though I am not sure it was a good idea to repeat the mistakes of PrintStream. 😉
The fact PrintWriter doesn’t report IOException makes it a poor choice for writing text to a Socket where you often need to know the connection has failed.