File.getAbsoluteFile() has the following syntax.
public File getAbsoluteFile()
In the following code shows how to use File.getAbsoluteFile() method.
//w ww . jav a 2 s . c om import java.io.File; public class Main { public static void main(String[] args) throws Exception{ File f = new File("test.txt"); // create new file in the system f.createNewFile(); // create new file object from the absolute path File f1 = f.getAbsoluteFile(); System.out.println(f1); } }
The code above generates the following result.