ArrayIndexOutOfBoundsException: Since JDK1.0
ArrayIndexOutOfBoundsException
occurs when your code tries to access an invalid index for a given array e.g.
negative index or higher index than length - 1.
java.lang.Object
à
java.lang.Throwable à
java.lang.Exception à
java.lang.RuntimeException
à
java.lang.IndexOutOfBoundsException à
java.lang.ArrayIndexOutOfBoundsException
public
class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException
Thrown
to indicate that an array has been accessed with an illegal index. The index is
either negative or greater than or equal to the size of the array.
ArrayStoreException: Since JDK1.0
ArrayStoreException
occurs when you have stored an element of type other than type of array.
java.lang.Object
à
java.lang.Throwable à
java.lang.Exception à
java.lang.RuntimeException à
java.lang.ArrayStoreException
public
class ArrayStoreException extends RuntimeException
Thrown
to indicate that an attempt has been made to store the wrong type of object
into an array of objects.
Example:
Object
x[] = new String[3];
x[0] = new Integer(0);
x[0] = new Integer(0);
No comments:
Post a Comment