Intro
This examples, will demonstrates how to get absolute path of the file. To get an absolute path of the file, you can use File.getAbsolutePath() method.
Examples
package com.freesamplecode.java.io; import java.io.File; public class GetAbsolutePathDemo { public static void main(String[] args){ File file = new File("D:/temp/data/aku.txt"); if(file.exists()){ System.out.println("Absolute Path : "+file.getAbsolutePath()); System.out.println("Path : "+file.getPath()); } } }
0 comments: