November 2006
Intermediate to advanced
224 pages
3h 29m
English
File file = new File("somefile.txt"); File absPath = file.getAbsoluteFile(); |
In this phrase, we get an absolute path for a file for which we specify a relative path. An absolute pathname gives the full path for a file starting from the file system’s root directory, i.e. c:\project\book\somefile.txt. A relative pathname specifies a file’s name and path relative to the current directory, i.e. somefile.txt if the current directory is c:\project\book. In many cases, a relative pathname consists of only the filename. The getAbsoluteFile() method of the File class returns a File object representing the absolute filename for the file represented by the File object on which it is called. ...
Read now
Unlock full access