Java IO Tutorial - Java File.mkdirs()


File.mkdirs() has the following syntax.

public boolean mkdirs()


In the following code shows how to use File.mkdirs() method.

// w w  w. jav a2 s. co  m


public class Main {
  public static void main(String[] args) {

    // returns pathnames for files and directory
    File f = new File("C:/Texts/a/b/c");

    // create directories
    boolean bool = f.mkdirs();

    System.out.print("Directory created? " + bool);


The code above generates the following result.