Similar to ArrayIndexOutOfBoundsException, this exception occurs when you try to access an invalid index that is outside the bounds of a collection or list.
set(int index, E element): This method is used to replace the element at a specific index in an array or list with a new element.