File f = new File("non_existing_dir/someDir"); System.out.println(f.mkdir()); System.out.println(f.mkdirs()); will yield false for the first [and no dir will be created], and true for the second, and you will have created non_existing_dir/someDir Ref: stackoverflow.com/questions/9820088/difference-between-mkdir-and-mkdirs-in-java-for-java-io-file
can i run mkdir program on online editor/compiler
thanks it was informative
u r welcome. God bless u.
Without using mkdirs() ,only by using mkdir () we can also create such nested files. Then what is the difference between these two methods.
File f = new File("non_existing_dir/someDir");
System.out.println(f.mkdir());
System.out.println(f.mkdirs());
will yield false for the first [and no dir will be created], and true for the second, and you will have created non_existing_dir/someDir
Ref:
stackoverflow.com/questions/9820088/difference-between-mkdir-and-mkdirs-in-java-for-java-io-file