You have been given the list of the names of the files in a directory. You have to select Java files from them. A file is a Java file if it’s name ends with .java. code example
Example: how to get all the names of the files in a folder in java?
List<String> results = new ArrayList<String>();
File[] files = new File("/path/to/the/directory").listFiles();
//If this pathname does not denote a directory, then listFiles() returns null.
for (File file : files) {
if (file.isFile()) {
results.add(file.getName());
}
}