System.out closed? Can I reopen it?

前端 未结 7 2406
逝去的感伤
逝去的感伤 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:18

    Do what Stas Kurilin suggests.

    In general, streams should be closed by the party that opened/created them.

    In your method, just flush the stream. Close it wherever it was opened when it is no longer needed.

提交回复
热议问题