How to check if a file exists in Java

It is very easy to check if file exists or not in your file system. You can use java.io.File’s exists() method to check if file exists or not.

Java program :

When you run above program, you will get following output:

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *