how to output list in java code example
Example 1: how to print list contents in java
System.out.println(Arrays.toString(list.toArray()));
Example 2: how to output a list in java
for (Song song : list) {
System.out.println(song.getName());
}
System.out.println(Arrays.toString(list.toArray()));
for (Song song : list) {
System.out.println(song.getName());
}