Home Tutorial Java Core Files Java file mkdir()

 
 

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");
		f.mkdir();
	}
}

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

Related Tags for Java file mkdir():


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.