The listFiles() method returns an array of
File objects that represent files and directories located on the specified path. The method is similar to list() but in this case we have handler to file instead of just a name in String.
2. Method signature
- method does not take any parameter
- an array File objects. The array will be empty if the directory is empty.
- SecurityException - when we do not have access to the directory
3.1. Code that prints names of the files from
In this article, we presented
listFiles() method that could be used to get an array of File objects representing files or directories on the specified path in the filesystem.