Should class IOException in Java have been an unchecked RuntimeException?

前端 未结 6 1011
夕颜
夕颜 2021-02-05 05:29

Do you agree that the designers of Java class java.io.IOException should have made it an unchecked run-time exception derived from java.lang.RuntimeException<

6条回答
  •  死守一世寂寞
    2021-02-05 06:12

    Probably the vast majority of IO exceptions are recoverable - permissions errors, lack of space on the drive, connection closed, etc, etc. I believe unchecked exceptions are supposed to be used for "there's no reasonable way to recover from this" sorts of situations.

提交回复
热议问题