/**
* Date:2019/8/8
* Author:zkh
* DESC:数组越界异常:访问不存在的索引,辉造成数组越界异常
*/
public class ArrayIndexOutOfBoundsExceptionDemo {
public static void main(String[] args) {
int[] arr = {3, 5};
System.out.println(arr[2]);
}
}
解决方法:
/**
* Date:2019/8/8
* Author:zkh
* DESC:数组越界异常:访问不存在的索引,辉造成数组越界异常
*/
public class ArrayIndexOutOfBoundsExceptionDemo {
public static void main(String[] args) {
int[] arr = {3, 5};
System.out.println(arr[2]);
}
}
解决方法: