Java中常见的运行时异常
- 空指针异常 NullPointerException
操作空对象 - 数组下标越界异常 IndexOutOfBoundsException
操作数组的时候 - 类型转换异常 ClassCastException
TreeSet或者TreeMap等需要排序的几个方法 - 算术运算异常 ArithmeticException
int a = 9/0;
- 参数非法异常 IllegalArgumentException
"Hello".split("*");
- 数字格式转换异常 NumberFormatException
Integer.parseInt("s123");
注意:这里只是列出了部分,具体请参照JavaApiRuntimeException及其子类