ArrayList.set(int position , element) Update an element at given position of an ArrayList.
position : Required , Integer , Position where element is to be replaced.
element : (required ) , new element to be placed at given position.
It returns the replaced element of the ArrayList.
Note : first position inside the ArrayList is 0 ( zero ).
If you try to replace the 4th element ( 3rd position ) then we will get error message (Index 3 out of bounds for length 3) as input position is beyond the last element of the ArrayList.