Create directory - Java File Path IO

Java examples for File Path IO:Directory Create

Description

Create directory

Demo Code


import java.io.*;
 
public class Main {
 
  public static void main(String[] args) {
   /*from  ww w . j  av a 2 s.  c  o m*/
    //create file object
    File dir = new File("C://Folder//DemoDirectory");
   
    boolean isDirectoryCreated = dir.mkdir();
   
    if(isDirectoryCreated)
       System.out.println("Directory created successfully");
    else
       System.out.println("Directory was not created successfully");
  }
}

Result


Related Tutorials