Topic: 这是异常吗?(ArrayIndexOutOfBoundsException)

  Print this page

1.这是异常吗?(ArrayIndexOutOfBoundsException) Copy to clipboard
Posted by: java007
Posted on: 2005-10-15 13:36

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:4
at wahaha.main<wahaha.java:8>

以上语句是在我创建了一个数组长度为四的数组以后编译时出现的,应该如何避免这样的错误呢?

2.Re:这是异常吗? [Re: java007] Copy to clipboard
Posted by: liumiaowilson
Posted on: 2005-10-15 14:06

检查数组索引值最大为a.length-1(如果数组为Object [] a的话)


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923