In Tutorials > The Java I/O API > File System Basics > Creating and Reading Directories, section "Listing a File System's Root Directories", the code prints to System.err instead of System.out when it is not printing an error.
Iterable<Path> dirs = FileSystems.getDefault().getRootDirectories();
for (Path name: dirs) {
System.err.println(name);
}
In Tutorials > The Java I/O API > File System Basics > Creating and Reading Directories, section "Listing a File System's Root Directories", the code prints to
System.errinstead ofSystem.outwhen it is not printing an error.