When you try to access an array element using an index that is outside the valid range (i.e., less than 0 or greater than or equal to the array's length), a 'ArrayIndexOutOfBoundsException' is thrown.

For example, if you have an array of size 5, the valid indices are 0, 1, 2, 3, and 4. Trying to access the element at index 5 or -1 will result in an 'ArrayIndexOutOfBoundsException'.

Correct Answer: B ArrayIndexOutOfBoundsException

ArrayIndexOutOfBoundsException: Accessing Array Elements Beyond Bounds

原文地址: https://www.cveoy.top/t/topic/ozXG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录