当我的程序抛出异常时,我得到的返回值为7.究竟是7是什么意思,我在哪里可以得到这些返回值的列表?或者那只是它发生的第一行(尽管我有一次-1)?JAVA:对于ArrayIndexOutOfBoundsException异常,返回值意味着什么?
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
at DataReader.get(DataReader.java:74)
at Employees.<init>(Employees.java:48)
at Main.main(Main.java:7)
很酷。谢谢!我知道我在阵列边界之外,但我不知道那显示了我试图访问的不存在的项目。 :D太糟糕了,并没有说在javadoc中。 – trusktr 2010-10-16 18:15:20
实际上,如果没有详细讨论,实际上至少要提到它:“[例外]抛出ArrayIndexOutOfBoundsException [is]来指示数组已被非法索引访问。索引为负数或大于或等于阵列的大小“。 http://download.oracle.com/javase/1.4.2/docs/api/java/lang/ArrayIndexOutOfBoundsException.html – 2010-10-16 18:36:53