How to make directory in java


 

How to make directory in java

This tutorial demonstrate how to make directory at specified location. This example will make a directory.

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.

Ads