The getName() method returns the name of the file or directory. Note that this method returns only the last name in the pathname sequence.
2. Method signature
- method does not take any parameter
- String - the name of the file or directory
3.1. The program that prints the file and directory name using
In this short article, we presented how to use
File.getName() method in a single example. This method returns the simple name of the file or directory pointed by the