java show last element in arraylist code example Example: arraylist get last E e = list.get(list.size() - 1);