Let's suppose user entered /home/pawal/helloDir/targetDirectory and helloDir doesn't exists then file.mkdir() will return false. So it is better to use file.mkdirs() to make sure such non existent directory too are created while creating targetDirectory.

See more here http://stackoverflow.com/questions/9820088/difference-between-mkdir-and-mkdirs-in-java-for-java-io-file