how to get the last element of a array in java code example Example: get last element of array java firstNum = numbers[0]; lastNum = numbers[numbers.length-1];