Simple add() method is used for adding an element at the end of the list however there is another variant of add method which is used for adding an element to the specified index. public void add(int index, Object element) This method adds the elemen…
package com.test; import java.util.ArrayList;import java.util.Iterator;import java.util.List; public class ArrayListDemo { public static void main(String args[]){ List<String> list = new ArrayList<String>(); list.add("luo…