当前位置:网站首页>File class (check)
File class (check)
2022-07-03 01:52:00 【Xu Feng &】
1,exists() Check for presence
2,length() Get the file length, which is long data type {
String character string :length(), Returns the number in the string
Array : Array name .length, Attribute , Get the number of elements in the array
aggregate : Collection object name .size(), Returns the number of collection elements
}
3,getName() Get the file name Sting data type
4,getPath() Return file path
5,getAbsolutePath() Returns the absolute path of the file
import java.io.File;
public class filedemo2 {
public static void main(String[] args) {
File file =new File("D:\\aaa.txt");
boolean f1 = file.exists();
if(f1){
System.out.println(" The file exists ");
}else{
file.mkdir();
System.out.println(" File created successfully ");
}
}
}
边栏推荐
- Function definition and call, this, strict mode, higher-order function, closure, recursion
- 网络安全-扫描
- [error record] navigator operation requested with a context that does not include a naviga
- Caused by: com. fasterxml. jackson. databind. exc.MismatchedInputException: Cannot construct instance o
- Tâche 6: regroupement DBSCAN
- 网络安全-漏洞与木马
- 网络安全-DNS欺骗与钓鱼网站
- Network security - password cracking
- Everything file search tool
- 【Camera专题】手把手撸一份驱动 到 点亮Camera
猜你喜欢
小程序開發的部分功能
Vant implements a simple login registration module and a personal user center
Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly
7-25 read numbers (loop switch)
A simple tool for analyzing fgui dependencies
STM32 - Application of external interrupt induction lamp
Take you ten days to easily complete the go micro service series (II)
[camera topic] turn a drive to light up the camera
A 30-year-old software tester, who has been unemployed for 4 months, is confused and doesn't know what to do?
自定义组件、使用npm包、全局数据共享、分包
随机推荐
网络安全-钓鱼
网络安全-防火墙
[Appendix 6 Application of reflection] Application of reflection: dynamic agent
Scheme and practice of cold and hot separation of massive data
网络安全-ACL访问控制列表
Huakaiyun (Zhiyin) | virtual host: what is a virtual host
Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day
云原生题目整理(待更新)
[QT] encapsulation of custom controls
JUC thread scheduling
Network security - phishing
小程序开发的部分功能
[untitled]
Introduction to flask tutorial
Certaines fonctionnalités du développement d'applets
Vant implements a simple login registration module and a personal user center
网络安全-病毒
Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
Analysis, use and extension of open source API gateway apisex
网络安全-浅谈安全威胁