当前位置:网站首页>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 ");
}
}
}
边栏推荐
- Huakaiyun | virtual host: IP, subnet mask, gateway, default gateway
- 7-25 read numbers (loop switch)
- Telecom Customer Churn Prediction challenge
- Pytest learning notes (12) -allure feature · @allure Step () and allure attach
- 技术大佬准备就绪,话题C位由你决定
- Vant implements a simple login registration module and a personal user center
- Openresty cache
- When the epidemic comes, how to manage the team as a leader| Community essay solicitation
- Query product cases - page rendering data
- Niuniu's ball guessing game (dynamic planning + prefix influence)
猜你喜欢
[shutter] animation animation (basic process of shutter animation | create animation controller | create animation | set value listener | set state listener | use animation values in layout | animatio
His experience in choosing a startup company or a big Internet company may give you some inspiration
查询商品案例-页面渲染数据
mysql
"Jetpack - livedata parsing"
[fluent] hero animation (hero animation use process | create hero animation core components | create source page | create destination page | page Jump)
Redis:Redis的简单使用
[camera topic] complete analysis of camera dtsi
[error record] an error is reported in the fluent interface (no mediaquery widget ancestor found. | scaffold widgets require a mediaquery)
High resolution network (Part 1): Principle Analysis
随机推荐
Huakaiyun (Zhiyin) | virtual host: what is a virtual host
[QT] encapsulation of custom controls
网络安全-DNS欺骗与钓鱼网站
STM32 - GPIO input / output mode
Everything文件搜索工具
How is the mask effect achieved in the LPL ban/pick selection stage?
[camera topic] turn a drive to light up the camera
[camera topic] how to save OTP data in user-defined nodes
Reprint some Qt development experience written by great Xia 6.5
Network security OpenVAS
Network security - talking about security threats
Summary of interval knowledge
Processing of tree structure data
PS去除水印详解
[camera special topic] Hal layer - brief analysis of addchannel and startchannel
LabVIEW安装第三方VISA软件后NI VISA失效
¢ growth path and experience sharing of getting an offer
Learn the five skills you need to master in cloud computing application development
JUC thread scheduling
网络安全-ACL访问控制列表