Question: check how many files in folder java?
Answer: list() method is invoked on directory , which returns a String array containing the names of files(and directories) contained in Level1 directory. Lastly, the length of array returned by list() method gives us the count of file names in the array, which is the desired file count we require.