Home Tutorial Java Core Files Java file mkdir()


Share on Google+Share on Google+
Java file mkdir()
Posted on: April 28, 2006 at 12:00 AM
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 java.io.* 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:

import java.io.*;

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.


Related Tags for Java file mkdir():

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.

Posted on: April 28, 2006

Recommend the tutorial

Advertisements Advertisements