异常名称:数组越界

异常名称:数组越界
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Domo.main(Domo.java:8)
案例:
int[] scores =new int[2];
scores[0]=90;
scores[1]=85;
scores[2]=65;
出现原因:超出数组数量
解决方案:数组长度重新定义

posted @ 2019-01-05 01:58  纸灰  阅读(393)  评论(0编辑  收藏  举报