By closing the nested PrintWriter, you also close the embedded stream System.out, which apparently prevents further writing to it (although I would really expect an exception instead of swallowing the output).
Thus, the whole problem can be reduced to:
public class Tester {
public static void main(String[] args) {
System.out.println("first");
System.out.close();
System.out.println("second");
}
}
"", . Sun, .
Update *
: System.out java.io.PrintStream :
private void write(String s) {
try {
synchronized (this) {
ensureOpen();
textOut.write(s);
textOut.flushBuffer();
charOut.flushBuffer();
if (autoFlush && (s.indexOf('\n') >= 0))
out.flush();
}
}
catch (InterruptedIOException x) {
Thread.currentThread().interrupt();
}
catch (IOException x) {
trouble = true;
}
}
ensureOpen() , , trouble ( -). , .