xuhb

View Post

java中如何创建一个指定文件,一个指定的目录

1
2
3
4
5
6
7
8
9
import java.io.File;
public class Test{
 public static void main(String[] args) throws Exception {
     File f = new File("d:/io");
     f.mkdirs();
     f = new File("d:/io/test.txt");
     f.createNewFile(); 
    }
}

 创建一个指定的文件和指定的目录

Java code?
1
2
File d = new File("D:\\io\\test.txt");
        d.createNewFile();

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-01-12
  • 2022-01-23
  • 2021-06-15
  • 2021-12-08
  • 2021-12-24
  • 2021-07-14
猜你喜欢
  • 2021-12-08
  • 2021-05-02
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案