Why am I getting errors with my Java try…catch?

后端 未结 6 1318
粉色の甜心
粉色の甜心 2021-01-24 05:09

I\'m starting to teach myself more about Java error handling, and this is my first program where I\'m trying to see specific errors instead of using catch (Exception e)

6条回答
  •  时光说笑
    2021-01-24 05:48

    Isnt the message clear? As you dont construct a File object, a FileNotFoundException can never be thrown in this try block. Therefor the compilers informs you that the catch block in unneccessary.

提交回复
热议问题