The getPath() method returns string representation of the file path. Returned string uses
File.separator - system-dependent default name-separator character (in Windows
\\ in Unix
/ character) to separate the file and directory names.
2. Method signature
- method does not take any parameter
- String - path to the file or directory
3.1. The program that returns paths of given file and directory
In this article, we presented
File.getPath() method that returns the system-dependent path to the file or directory. The method used default system separator to separate the individual path components.