Page 1304 - AP Computer Science A, 7th edition
P. 1304

11. (C) Statement III will cause an IndexOutOfBoundsException because there is no slot 4. The final element, “Luis”, is in slot 3. Statement I is correct: It replaces the string “Harry” with the string “6”. It may look peculiar in the list, but the syntax is correct. Statement II looks like it may be out of range because there is no slot 4. It is correct, however, because you must be allowed to add an element to the end of the list.


































































































   1302   1303   1304   1305   1306