1//Creating arraylist example
2ArrayList<String> list = new ArrayList<String>();
3
4//Adding objects in arraylist
5list.add("Mango");
6list.add("Banana");
7
8//Change the element (index,"new value")
9list.set(1,"Dates");
10
11//Return the 2nd element, because index starts from 0
12System.out.println("Returning element: " + list.get(1));