Get name of specified file or directory : Directory « File « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web Services SOA
27. EJB3
28. Spring
29. PDF
30. Email
31. J2ME
32. J2EE Application
33. XML
34. Design Pattern
35. Log
36. Security
37. Apache Common
38. Ant
39. JUnit
Java
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » File » Directory 
11. 4. 14. Get name of specified file or directory
import java.io.File;

public class Main {
  public static void main(String[] args) {
    File file = new File("C:/Demo.txt");

    System.out.println("File name is : " + file.getName());
  }
}
11. 4. Directory
11. 4. 1. Create a directory (or several directories)
11. 4. 2. Create directory
11. 4. 3. Create directory along with required nonexistent parent directories
11. 4. 4. Create a directory; all ancestor directories must exist
11. 4. 5. Create a directory; all non-existent ancestor directories are automatically created
11. 4. 6. Create a directories recursively
11. 4. 7. Creates a new and empty directory in the default temp directory using the given prefix.
11. 4. 8. Determine File or Directory
11. 4. 9. Deleting a Directory (an empty directory)
11. 4. 10. Determine if file or directory exists
11. 4. 11. Determine if File or Directory is hidden
11. 4. 12. If a file or directory readable
11. 4. 13. Get name of parent directory
11. 4. 14. Get name of specified file or directory
11. 4. 15. Get parent directory as a File object
11. 4. 16. Get the content of a directory
11. 4. 17. Checks, whether the child directory is a subdirectory of the base directory.
11. 4. 18. Delete file or directory
11. 4. 19. Delete directory recursively
11. 4. 20. Delete file or directory when virtual machine terminates
11. 4. 21. Calculate directory size
11. 4. 22. Change last modified time of a file or directory
11. 4. 23. Mark file or directory Read Only
11. 4. 24. Rename file or directory
11. 4. 25. Moving a File or Directory to Another Directory
11. 4. 26. Search for files recursively
11. 4. 27. Traversing all files and directories under dir
11. 4. 28. Traversing only directories under dir
11. 4. 29. Traversing only files under dir
11. 4. 30. Copying a Directory
11. 4. 31. Check if a directory is not empty
11. 4. 32. Getting the Current Working Directory
11. 4. 33. Get all files and folders under a certain folder and save them to a set
11. 4. 34. Recursively search a directory tree
11. 4. 35. Searches through the directory tree
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.