File.getParent() has the following syntax.
public String getParent()
In the following code shows how to use File.getParent() method.
/*from w w w .java2 s .co m*/ import java.io.File; public class Main { public static void main(String[] args) throws Exception { // create new files File f = new File("c:/asdf/"); System.out.print(f.getParent()); } }
The code above generates the following result.