Difference between Throws in method signature and Throw Statements in Java

前端 未结 4 753
不知归路
不知归路 2021-01-30 02:00

I am trying to make it clear of the difference between Throws in method signature and Throw Statements in Java. Throws in method signature is a

4条回答
  •  天命终不由人
    2021-01-30 02:05

    RuntimeExceptions dont have to be handled in try-catch block so they dont have to be declared as thrown and NoSuchElementException is RuntimeException because it extends it.

提交回复
热议问题