Given:
and that the invocation
is issued from a directory that has two subdirectories, "dir1" and "dir2", and that "dir1" has a file "file1.txt" and "dir2" has a file "file2.txt".
Question: why is the output "false true"? The first time through the for loop, path = "dir1", and file = ("dir1", "file2.txt"), but file2.txt doesn't exist in that directory. So why isn't a FileNotFoundException generated instead?
Update: never mind, just looked in the API and see that it
Returns:
true if and only if the file denoted by this abstract pathname exists and is a normal file; false otherwise
Throws:
SecurityException -
So I guess my question is aimed more at the
Java developers - wouldn't it make more sense if this method threw a FileNotFoundException if a file wasn't found? Hm?