File class getAbsoluteFile()method example
Returns the absolute form of this abstract pathname.
File class getAbsoluteFile()method example. This example shows you how to use getAbsoluteFile() method.This method Returns the absolute form of this abstract pathname.
Here is the code:-
/**
* @Program that Returns the absolute form of this abstract pathname.
* GetAbsoluteFile.java
* Author:-RoseIndia Team
* Date:-30-May-2008
*/
import java.io.*;
public class GetAbsoluteFile {
public static void main(String[] args) throws IOException {
File f = new File("/home/girish/Desktop/g.txt");
if (f.exists()) {
System.out.println("Pathname of the File is: " + f.getAbsoluteFile());
} else {
System.out.println("File does not exists");
}
}
} |
Output of the program:-
| Pathname of the File is: /home/girish/Desktop/g.txt |
|