concept indexoutofboundsexception in category java

appears as: IndexOutOfBoundsException, n IndexOutOfBoundsException
OCA Java SE 8 Programmer I Certification Guide

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.

  • If the class EJavaGuruExcep is executed using the following command, it prints IndexOutOfBoundsException:
    java EJavaGuruExcep
  • 7.5.1. ArrayIndexOutOfBoundsException and IndexOutOfBoundsException

    As shown in figure 7.17, ArrayIndexOutOfBoundsException and IndexOutOfBounds-Exception are runtime exceptions, which share an IS-A relationship. IndexOutOfBoundsException is subclassed by ArrayIndexOutOfBoundsException.

    Figure 7.17. Class hierarchy of ArrayIndexOutOfBoundsException

    An ArrayIndexOutOfBoundsException is thrown when a piece of code tries to access an array out of its bounds (either an array is accessed at a position less than 0 or at a position greater than or equal to its length). An IndexOutOfBoundsException is thrown when a piece of code tries to access a list, like an ArrayList, using an illegal index.

    sitemap

    Unable to load book!

    The book could not be loaded.

    (try again in a couple of minutes)

    manning.com homepage
    test yourself with a liveTest