java how to print the elements of arrayList code example Example: print arraylist java Arrays.toString(list.toArray())