set() Method : Java.util.ArrayList


Declaration :

Explanation :

Purpose Method returns true if this list contains the specified element
Parameters index ==> The index of the element to replaced
element ==> element to be stored at the specified position
Return Value Element which was previously at the specified position
Exception IndexOutOfBoundsException ==> If index is out of range

Example

The following example shows the usage of java.util.Arraylist.set() method.

Output :