1、异常处理方式:向外抛出 throws;
捕获异常 try-catch-finally;
2、自定义异常:继承异常类即可;
3、常见异常:java.io.IOException IO异常;
DataFormatException 数据格式化异常;
ClassNotFoundException 加载类时没有找到指定的类抛出的异常;
ParseException 解析异常;
SQLException SQL语句错误异常;
AruthmeticException 算数异常;
ClassCastException 类型转换异常;
NullPointException 空指针异常;
IndexOutBoundException 索引越界异常,其子类:ArrayIndexOutBoundException 数组下标越界异常、StringIndexOutBoundException 字符串索引越界异常;
Java中的异常处理
最新推荐文章于 2024-09-13 16:53:45 发布