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.|
Posted on: April 3, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles