java why arraylist gets object code example Example 1: arraylist get value at index java get(index); Example 2: how to get elements of a list in java int num = list.get(0);