集册 Java实例教程 创建新目录

创建新目录

欢马劈雪     最近更新时间:2020-01-02 10:19:05

408
创建新目录
//来自 N o w  J a v a  . c o m

import java.io.IOException;

import java.nio.file.FileSystems;

import java.nio.file.Files;

import java.nio.file.Path;


public class Main {

  public static void main(String[] args) {

    Path newdir = FileSystems.getDefault().getPath(

        "C:/folder1/folder2/2010/");


    try {

      Files.createDirectory(newdir);

    } catch (IOException e) {

      System.err.println(e);

    }


  }

}