![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e17. Getting the Parents of a Filename Path// Get the parent of a relative filename path File file = new File("Ex1.java"); String parentPath = file.getParent(); // null File parentDir = file.getParentFile(); // null // Get the parents of an absolute filename path file = new File("D:\\almanac\\Ex1.java"); parentPath = file.getParent(); // D:\almanac parentDir = file.getParentFile(); // D:\almanac parentPath = parentDir.getParent(); // D:\ parentDir = parentDir.getParentFile(); // D:\ parentPath = parentDir.getParent(); // null parentDir = parentDir.getParentFile(); // null
e14. Converting Between a Filename Path and a URL e15. Getting an Absolute Filename Path from a Relative Filename Path e16. Determining If Two Filename Paths Refer to the Same File e18. Determining If a Filename Path Is a File or a Directory
© 2002 Addison-Wesley. |