1. Introduction
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
Parameters:
- method does not take any parameter
Returns
- String - path to the file or directory
3. Examples
3.1. The program that returns paths of given file and directory
The output:
4. Conclusion
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.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}