

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a directory using Java?
You can create a directory in the specified path using the mkdir() method of the File class. This method returns true is a directory created.
Example
import java.io.File; public class CreateDirectory { public static void main(String args[]) { String dir ="C:/Users/Tutorialspoint/Desktop/movies/sampledirectory"; File directory = new File(dir); System.out.println(directory.mkdir()); } }
Output
true
- Related Questions & Answers
- How to create a Directory recursively using Java?
- How to create a directory hierarchy using Java?
- How to create a directory using Python?
- How to create a Directory using C#?
- How to create a directory in project folder using Java?
- How to create a directory recursively using Python?
- Create a directory in Java
- How to create a new directory by using File object in Java?
- How to create a unique directory name using Python?
- How to create a zip archive of a directory using Python?
- How to create a new directory in Linux using the terminal?
- How to list all files in a directory using Java?
- How to remove a directory using Python?
- How to list all files (only) from a directory using Java?
- How to create bulk users in the active directory using PowerShell?
Advertisements