aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes boolean mkdir() & boolean mkdirs() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "boolean mkdir() & boolean mkdirs()" Watch "boolean mkdir() & boolean mkdirs()" New topic
Author

boolean mkdir() & boolean mkdirs()

Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1241
in the File class.
I know what the mkdir() does.
And what is the mkdirs() for?
The book i study on doesn't have mkdirs() so.. i am not sure
thanks.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
The mkdir method will create the current directory(if it is possible). The mkdirs method will create all necessary relative directory.
Example, if the pathname is "c:\temp\test\mydir\", if we use mkdirs(), and the dir temp, test and mydir don't exist, they will all be created. If we use mkdir(), the directory mydir will be created only when temp, test are existing.
Correct me if I am wrong, hope it helps.

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹²³ at my homepage.


Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="http://www.jiris.com/" target="_blank" rel="nofollow">www.jiris.com</a>, Java resource, mock exam, forum
Radu Zaharia
Greenhorn

Joined: Aug 01, 2001
Posts: 18
As the Java API documentation says, "Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories."
For questions of this type, I think it's easier and quicker to look first at the Java API documentation, don't you think? I don't mean to be rude, I only want to point you how you can find a quicker solution.
Radu Zaharia


Radu Zaharia
SCJP 1.4, SCBCD 1.3
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: boolean mkdir() & boolean mkdirs()
 
Similar Threads
how can the mkdirs() method of File be used ?
help needed with creating folder
mkdir and mkdirs
java.io
diference between mkdirs and mkdirs?