System.out closed? Can I reopen it?

前端 未结 7 2248
逝去的感伤
逝去的感伤 2020-12-06 09:34

I was helping a friend to write some Java code, who doesn\'t know a lot about Java. So I wrote him some helper functions to easily get things done that are a little quirky i

相关标签:
7条回答
  • 2020-12-06 10:26

    System.out is a PrintStream, therefore the code you provide above has literally no advantage over just calling System.out.print directly. The reason it is not writing anymore is that close did, in fact, close System.out.

    If this is for logging, learn log4j for your friend or help him learn it. Log4j handles situations where you need to write to a file stream, standard out, etc. simultaneously quite well.

    0 讨论(0)
提交回复
热议问题