Check out example codes for "remove last element from arraylist java". It will help you in understanding the concepts better.

Code Example 1

ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);

list.remove(list.size()-1); //removes 3

Learn ReactJs, React Native from akashmittal.com