Chapter 9, 9.2

1. Assume that the array a contains the five integers 34, 23, 67, 89, and 12. Write the values of the following expressions:- a. 34  b. a[a.length -1] =4  c. a[2]+ a[3] = 156What happens when a program attempts to access an item at an index that is less than 0 or greater than or equal to the array’s length?– The JVM checks the values of subscripts before using them and throws an ArrayIndexOutOfBoundsException if they are out of bound. 

Leave a Comment