Home Tutorial Java Corejava How to make directory in java

 
 

How to make directory in java
Posted on: April 12, 2010 at 12:00 AM
This tutorial demonstrate how to make directory at specified location. This example will make a directory.

Description:

This example demonstrate how to create a directory at specified path.

Code:

import java.io.File;

public class MakeDir {
  public static void main(String[] a) {
    File file1 = new File("c:\\newDir");
    file1.mkdirs();
  }
}

Output:

The result of this program is that it will make a dir at root directory of C drive.

Related Tags for How to make directory in java:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.