Why don't we close `System.out` Stream after using it?

后端 未结 3 532
死守一世寂寞
死守一世寂寞 2020-12-06 16:00

I just want to know, we usually close streams at the end, but why don\'t we close System.out PrintStream with System.out.close()?

3条回答
  •  一整个雨季
    2020-12-06 16:55

    because we didn't open it the VM did and it's his job to close it unless otherwise documented

    it's similar to the C++ adage of I don't own it, don't delete it.

提交回复
热议问题