Java Rumblings
Pages
Home
TOC
Spring
Core Java
Design Pattern
Concurrency
Hibernate
Garbage Collection
Exception
Books
Java API
Collections
Reflection
Class Loader
Annotation
Generics
Monday, 18 April 2011
How to get the parent directory of a file in java?
Use file.getParent() method for this:
File file = new File("C:/File/demo.txt")
;
String strParentDirectory = file.getParent()
;
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment