Hi I was going through IO API and got something unexpected, Surely there is reason behind it which I don't know.Can any one tell me that why PrintWriter class's write() method implemented in such a way that it is eating up an exception ?
Below code is not throwing "IOException : Stream closed" because it is handled in write() method while it is thrown by ensureOpen() method.
pw = new PrintWriter(file);
pw.write("Hello\n");
pw.flush();
pw.close();
pw.write("World");
pw.flush();
But for FileWriter class, After closing FileWriter object, Again if you try to use its write() method it will through "java.io.IOException: Stream closed" !