java how to access a variable from a list using an index code example Example: how to get elements of a list in java int num = list.get(0);