数组下标越界异常
int[] intArr = new int[5];
// java.lang.ArrayIndexOutOfBoundsException
//java的数组的大小不可以被改变即读写不可改变
intArr[80] = 5;
// java.lang.ArrayIndexOutOfBoundsException
//数组的范围是0-4
// System.out.println("intArr[5] = " + intArr[5]);
空指针异常
// java.lang.NullPointerException
char[] charArr = null;
System.out.println("charArr[0] = " + charArr[0]);
空指针异常大部分会在二维数组时候,第一个维度指定长度,但是第二个没有,也没给初值,所以就会抛异常。