identify the last element in list java code example
Example 1: get last element of array java
firstNum = numbers[0];
lastNum = numbers[numbers.length-1];
Example 2: how to find the last item of a list
list1 = ['a','b','c']
print(list1[-1])
firstNum = numbers[0];
lastNum = numbers[numbers.length-1];
list1 = ['a','b','c']
print(list1[-1])