java get last element of list

Java
arrayName[arrayName.length() - 1];ArrayList<Integer> list = new ArrayList<Integer>(5); 
int last = list.get(list.size() - 1); 
Source

Also in Java: