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