go to previous page   go to home page   go to next page        

Answer:

Yes.

Methods of File

Here is brief documentation for some useful methods in File. See your on-line documentation for more.

Methods of the File Class
boolean canRead() Returns true if the file exists and can be read;
otherwise returns false.
boolean canWrite() Returns true if the file exists and can be written;
otherwise returns false.
boolean delete() Deletes the file or directory. Returns true on success;
otherwise returns false.
boolean exists() Returns true if the file exists;
otherwise returns false.
String getName() Returns the file name or directory name.
String getPath() Returns the path name.
boolean isDirectory() Returns true for an existing directory;
otherwise returns false.
boolean isFile() Returns true for an existing file;
otherwise returns false.
long length() Returns the length of a file.
String[] list() Returns an array which lists the files and
directories in the directory. If the File is not
a directory or there is an IO error, null is returned.
boolean mkdir() Creates the directory named in this File object.
Returns true if successful, otherwise, false.

There are many more useful methods. If there is something file related you wish to do, check the complete documentation.

QUESTION 10:

(Brain teaser: ) Is it possible for isDirectory() and isFile() both to return false?