Reputation: 6277
I have rather a very basic question but somehow it is confusing to me. Normally to check the existence of both file and directory we can do so by using boolean file.exists()
However i am wondering, is there any way that one can determine if given path is a directory or a file.
It would be nice if you can provide some short example using java.
Upvotes: 0
Views: 3731
Reputation: 120178
Yes, from the documentation, there are the methods isFile
and isDirectory
Upvotes: 6