In this section, you will learn how to check the existence of the particular file.
Description of code:
This is a very simple task. Here we have to check whether the specified file or directory exists or not. For this, we have created an object of class File and used exists() method. This method checks the existence of the file and returns true if the files exists otherwise returns false.
exists(): It checks whether the file or directory denoted by the pathname exists or not.
Here is the code:
In the above code, method exists() is used. This method checks whether the file exists or not.
|File or Directory does not exists.|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.