当前位置:网站首页>File create file problem
File create file problem
2022-04-21 22:10:00 【Can't learn WOW】
File f1 = new File("demo1\\javase\\j1.txt");//C:\java_dev\apache-tomcat-10.0.16\File_01 It's hidden here File_01 The absolute path of
System.out.println(f1.createNewFile());// However, using createNewFile Only files can be created , And when the previous directory is created
// The following is the error of directly creating the report
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-DFW0L4fu-1650288811398)(C:\Users\86159\AppData\Roaming\Typora\typora-user-images\image-20220418212252824.png)]](/img/9a/b93614509ba60d1fe5d4583ac4d80e.png)
File f1 = new File("demo1\\javase\\j1.txt");
System.out.println(f1.mkdirs());
Let's change it to mkdirs(). Find the following
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-lYu1PWem-1650288746071)(C:\Users\86159\AppData\Roaming\Typora\typora-user-images\image-20220418212733156.png)]](/img/7f/eb270e1b6f722669bc6c50c99a9ab6.png)
j1.txt Becomes the name of the directory .
The right thing to do is :
File f1 = new File("demo1\\javase");
System.out.println(f1.mkdirs());
File file = new File(f1, "j1.txt");
System.out.println(file.createNewFile());
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-eqmCRqOz-1650288746072)(C:\Users\86159\AppData\Roaming\Typora\typora-user-images\image-20220418213030335.png)]](/img/d9/37bc899538ccd8cc2ff7dd226fd26e.png)
版权声明
本文为[Can't learn WOW]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212206183437.html
边栏推荐
- Vscode 插件包下载并离线安装
- The third floor of leetcode Langya list - the container with the most water
- Byte daily practice (OC)
- EventBridge 集成云服务实践
- Download and install the vscade plug-in package offline
- [WebGIS] Introduction to WebGIS, desktop GIS, mobile GIS and 3D GIS
- 因为疫情让服装行业彻底认识到了数字化转型的必要性。
- MYPINPAD和SmartPesa合并,成为移动支付受理领域的全球领导者
- Software life cycle
- 软件测试分类与软件测试的原则
猜你喜欢

软件测试分类与软件测试的原则

unity3d导入倾斜模型等

Smart Chemical Park solutions

Building local canal middleware for data migration -- Inspiration from cache breakdown

redis配置文件详解

es6如何求两个数组的交集

【VSCode】调试器debugger详细使用手册

怎么用vbs实现微信自动发送消息功能

kotlin爬虫app,Android开发面试准备

ROS——编译PCL相关程序报错:Could not find a package configuration file provided by “PCL“
随机推荐
ISMAR 2022 journal paper (tvcg) contribution exchange
2022 Chongqing's latest architectural eight members (Civil Engineering) simulation question bank and answers
Finding a way to combine new technologies with itself is the key to the development of industrial Internet
MYPINPAD和SmartPesa合并,成为移动支付受理领域的全球领导者
Oracle cascade delete table (not subject to foreign key constraints)
【ES6】函数的扩展
Mswep data NC format to TIF format
The @ select annotation is used in the mapper of mybtais, and the if annotation is used
unity3d导入倾斜模型等
what? Your company has not set the JVM initial and maximum heap memory size to the same value?
在線CSV轉YAML工具
智慧化工园区解决方案
Echart writes a large screen showing a circular edge gradient histogram
Outil CSV - YAML en ligne
INT 102_TTL 09
【Pinia】第二章 核心概念
数据库事务学习总结
Unity3d import tilt model, etc
Oracle query execution plan
The third floor of leetcode Langya list - the container with the most water