import java.io.*;

public class TestFile {

        

         public static void main(String[] args) throws Exception {

                   File f = new File("e://xxx//yyy");

                   System.out.println(f.mkdirs());//生成所有目录

                   //f.mkdir();  必须xxx目录存在才能生成yyy目录

                   //f.createNewFile();

                  

                   File f2 = new File("E://zzz//t.txt"); //不能生成文件,只能用createNewFile();

                   f2.createNewFile();   //且zzz目录必须存在

         }

}

相关文章:

  • 2021-11-30
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-12-29
  • 2022-01-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
相关资源
相似解决方案