您当前的位置: 首页 >  Java

罗四强

暂无认证

  • 2浏览

    0关注

    497博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

java代码 创建文件夹的方法

罗四强 发布时间:2018-06-30 23:58:43 ,浏览量:2

1、

?
1
2
3
4
5
String strPath = "E:\\a\\aa\\aaa.txt" ;
File file = new File(strPath);
if (!file.exists())){
  file.file.mkdirs();
}

2、

?
1
2
3
4
5
6
7
String strPath = "E:\\a\\aa\\aaa.txt" ;
File file = new File(strPath);
File fileParent = file.getParentFile();
if (!fileParent.exists()){
  fileParent.mkdirs();
}
file.createNewFile();

 

关注
打赏
1625533955
查看更多评论
立即登录/注册

微信扫码登录

0.0376s