file getPath Example
file class getPath example. This example shows you how to use getPath method.
File class getPath example. method generates String representations of the abstract pathname of file or directory method is being called by a String class object.method is mainly used to get String representations of abstract pathnames.
Here is the code:-
/**
* @Program uses getPath method to get the string representation
* of abstract pathnames of directories and files.
* GetPath.java
* Author:-RoseIndia Team
* Date:-30-june-2008
*/
import java.io.*;
public class GetPath {
public static void main(String args[]) {
File rear = new File("/tmp/dino8913.tmp"), rearview = new File(
"/tmp/Ben10.tmp");
String str = rear.getPath(), str1 = rearview.getPath();
System.out.println("String representation of files\n"+ str);
System.out.println(str1);
}
} |
Output of the program:-
String representation of files
/tmp/dino8913.tmp
/tmp/Ben10.tmp |
|