Return | Method | Summary |
---|---|---|
String | getParent() | Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory. |
File | getParentFile() | Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory. |
import java.io.File;
public class Main {
public static void main(String[] args) {
File aFile = new File("h:/Main.java");
System.out.println(aFile.getParent());
System.out.println(aFile.getParentFile());
}
}
The output:
h:\
h:\
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |