how to output an arraylist in java code example Example: print arraylist java Arrays.toString(list.toArray())