array list remove last code example
Example 1: remove last element from arraylist java
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
list.remove(list.size()-1); //removes 3
Example 2: remove last element from list python
>>> l = list(range(1,5))
>>> l
[1, 2, 3, 4]
>>> l.pop()
4
>>> l
[1, 2, 3]