正文
请写出你最常见到的5个runtime exception?
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
对于一个有1~2年左右编程经验的人来说,总会经常遇到一些常见的异常,其中有些就是Runtime Exception。比如:
NullPointerException - 当调用一个未初始化的引用变量(实际值为null)的实例Field、实例方法时都会引发该异常。
ArithmeticException - 算术异常。比如5/0将引发该异常。
ArrayIndexOutOfBoundsException:数组索引越界异常。
ClassCastException:类型转换异常。
IllegalArgumentException:参数非法的异常。