APCS Java Subset

Class ArrayIndexOutOfBoundsException

  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byjava.lang.IndexOutOfBoundsException
                  extended byap.java.lang.ArrayIndexOutOfBoundsException
All Implemented Interfaces:

public class ArrayIndexOutOfBoundsException
extends java.lang.IndexOutOfBoundsException

Students should understand this error/exception when it occurs in a program.

An object of this class is thrown when code accesses an array with an illegal index. This happens when an index is negative or greater than or equal to the length of the array being indexed. For example:

  int[] list = new int[5];
  list[5] = 33;            // illegal index, maximum index is 4


See Also:
Serialized Form

Constructor Summary
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public ArrayIndexOutOfBoundsException()

unofficial documentation for the APCS Java Subset