Here you can find the source of mkdirs(String dirName)
public static synchronized boolean mkdirs(String dirName)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may import java.io.File; public class Main { public static synchronized boolean mkdirs(String dirName) { ///*from w ww.j a v a2 s . co m*/ // NOTE: This method needs to be synchronized due to issues // with the IBM and Sun JVMs. From the Sun website: // "File.mkdirs fails to create the entire hierarchy of // directories if another application or thread creates // one of the intervening directories while mkdirs is // running." // // Synchronizing here will at least protect the app // from clobbering itself. There is not much that can // be done to protect from an external process creating // colliding directory names. // File dirPath = new File(dirName); return dirPath.exists() || dirPath.mkdirs(); } }