Share on Google+Share on Google+

Java file mkdir()

This section demonstrates you the use of method mkdir().

Java file mkdir()

This section demonstrates you the use of method mkdir().

Description of code:

Now the manipulation of files is become an easy task. Java has provide various useful classes and their methods to handle the file operations. This makes the programming much easier. If you want to create a file, delete a file, create a directory then by just using the built in methods provides by the* package, you will get the required result.

You can see in the given example, we have created an object of File class and parse a string representing the directory name along with the path. Then we have called the method mkdir() through the object of file class. On executing the given code, you will get the newly generated directory in the given path.

Here is the code:


public class Filemkdir {
	public static void main(String[] args) {
		File f = new File("C:/hello");

Through the use of method mkdir(), you can create a directory of your choice.


Posted on: April 28, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.