last element of array list code example
Example 1: how to get last element of array
return array[array.length - 1];
Example 2: java last element in array
arrayName[arrayName.length() - 1];
Example 3: java get last element of list
ArrayList<Integer> list = new ArrayList<Integer>(5);
int last = list.get(list.size() - 1);
Example 4: how to get the last element of an array
//Lets we have a array called arr
let arr = ["s","fg","d"]
//Lets print the last element
print(arr[arr.length-1])