Create a New Directory


import java.io.File;

public class CreateDirectoryExample
{
    public static void main(String[] args)
    {
        // Create an abstract directory
        File file = new File("Java Stuff");

        // Create the directory by calling mkdir() method. This
        // method return true if and only if the directory was
        // created. If false is returnned no directory is created
        // because for instance the directory was already exists.
        if (file.mkdir())
        {
            System.out.println("Directory = " + file.getAbsolutePath() + ".");
        } else
        {
            System.out.println("No directory was created.");
        }
    }
}


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email