Use the mkdir method of the File class to create the directory
public class fileClass{
public fileClass() throws IOException{
File dir = new File("/Users/Shared/java/");
//Create a directory using mkdir
dir.mkdir();
}
}
In the above sample code, a directory is created with an absolute path in an instance of the File class, and it is created with the mkdir method.
When you create a file, it will not be created even if it has already been created.
Recommended Posts