how to print the last element of an array in java code example Example: java last element in array arrayName[arrayName.length() - 1];