0

I am trying to create an empty folder with the name http://www.example.com/, but for some reason I can't. I tried:

    File dir = new File("http://www.example.com/");
    dir.mkdir();

but nothing happends. Why?

3

1 Answer 1

0
File file = new File("C:\\DirectoryData");
if (!file.exists()) {
    if (file.mkdir()) {
        System.out.println("Directory created!");
    } else {
        System.out.println("Failed to create directory");
    }
}

File files = new File("C:\\Directory2\\Subdir\\Subdir");
if (files.exists()) {
    if (files.mkdirs()) {
        System.out.println("directories created!");
    } else {
        System.out.println("Failed to create directories!");
    }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.