java method output list code example Example: how to output a list in java for (Song song : list) { System.out.println(song.getName()); }