You can solve this problem very easily. What you need to do, just create a File object and pass some file name or a directory in it.
We are using a following methods to solve this problem.
isDirectory(): It checks whether the file is a directory or not.
getAbsolutePath(): It returns the absolute path of a file or directory.
Code of the program is given below:
The output of this example is given below:
the name you have entered is a file : FileOrDirectory
the path is C:\FileOrDirectory\FileOrDirectory
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 7, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles