Here is a code I came up with, please let me as if it worked or not.
public class ArrayListDemo {
public static void main(String[] args) {
ArrayList<Integer> arr = new ArrayList<Integer>(5);
arr.add(20);
arr.add(15);
arr.add(30);
arr.add(45);
System.out.println("Size of list: " + arr.size());
for (Integer number : arr) {
System.out.println("Number = " + number);
}
arr.remove(3);
System.out.println("Now, Size of list: " + arr.size());
for (Integer number : arr) {
System.out.println("Number = " + number);
}
}
}