1import java.io.File;
2
3// demonstrates how to create a directory in java
4public class JavaCreateDirectoryExample
5{
6 public static void main(String[] args)
7 {
8 File dir = new File("/Users/al/tmp/TestDirectory");
9
10 // attempt to create the directory here
11 boolean successful = dir.mkdir();
12 if (successful)
13 {
14 // creating the directory succeeded
15 System.out.println("directory was created successfully");
16 }
17 else
18 {
19 // creating the directory failed
20 System.out.println("failed trying to create the directory");
21 }
22 }
23}
24