立即学习:https://edu.csdn.net/course/play/16885/245614?utm_source=blogtoedu
数组中常见错误
java.lang.ArrayIndexOutofBoundsException数组下标越界异常
原因
1.下标大于等于数组长度
2.数组下标小于0。
声明数组并为其分配空间,以下写法不正确
int nums[]=new int[5];
nums={1,2,3,4}
立即学习:https://edu.csdn.net/course/play/16885/245614?utm_source=blogtoedu
数组中常见错误
java.lang.ArrayIndexOutofBoundsException数组下标越界异常
原因
1.下标大于等于数组长度
2.数组下标小于0。
声明数组并为其分配空间,以下写法不正确
int nums[]=new int[5];
nums={1,2,3,4}