Share on Google+Share on Google+

How to make directory in java

Advertisement
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.

Advertisements

Posted on: April 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.