集册 Java实例教程 捕获异常的语法

捕获异常的语法

欢马劈雪     最近更新时间:2020-01-02 10:19:05

464
您可以通过使用try语句来捕获异常,该语句具有以下一般形式:

try

{

   statements that can throw exceptions

}/** 来自 n o w j a   v  a . c o m - 时  代  Java**/

catch (exception-type identifier)

{

   statements executed when exception is thrown

}