Why such an example is performed without issuing any exceptions.
PrintWriter os = new PrintWriter(System.out, true); os.close(); os.println("text"); PrintWriter not an ordinary class; if you look at the documentation for the class, you will see the following:
Methods in this class never throw I / O exceptions, although some of its constructors may. The client may inquire {@link #checkError checkError ()}.
Those. it swallows all I / O errors.
Source: https://ru.stackoverflow.com/questions/554824/
All Articles
PrintWriter os = new PrintWriter(System.out, true);os.close();os.println("text");- jisecayeyo