当前位置:网站首页>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 ");
}
}
}边栏推荐
- Performance test | script template sorting, tool sorting and result analysis
- [data mining] task 5: k-means/dbscan clustering: double square
- 技术大佬准备就绪,话题C位由你决定
- Asian Games countdown! AI target detection helps host the Asian Games!
- 【数据挖掘】任务4:20Newsgroups聚类
- A simple tool for analyzing fgui dependencies
- LeetCode 987. Vertical order transverse of a binary tree - Binary Tree Series Question 7
- His experience in choosing a startup company or a big Internet company may give you some inspiration
- 【數據挖掘】任務6:DBSCAN聚類
- Network security NAT network address translation
猜你喜欢

Network security - vulnerabilities and Trojans

Learn BeanShell before you dare to say you know JMeter

自定义组件、使用npm包、全局数据共享、分包

Leetcode skimming questions_ Sum of two numbers II - enter an ordered array

【数据挖掘】任务3:决策树分类

小程序開發的部分功能

View of MySQL

LabVIEW安装第三方VISA软件后NI VISA失效

深度(穿透)选择器 ::v-deep/deep/及 > > >

Asian Games countdown! AI target detection helps host the Asian Games!
随机推荐
Scheme and practice of cold and hot separation of massive data
Related concepts of GDB in embedded system
[AUTOSAR cantp] -2.11-uds diagnostic response frame data segment data padding data filling and data optimization data optimization (Theory + configuration)
Certaines fonctionnalités du développement d'applets
PS remove watermark details
Network security - vulnerabilities and Trojans
C application interface development foundation - form control (1) - form form
函数的定义和调用、this、严格模式、高阶函数、闭包、递归
The testing process that software testers should know
Network security - scanning and password explosion 2
Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
Huakaiyun (Zhiyin) | virtual host: what is a virtual host
[error record] the shutter component reports an error (no directionality widget found. | richtext widgets require a directionality)
[untitled]
Network security OpenVAS
7-25 read numbers (loop switch)
Answers to ten questions about automated testing software testers must see
[understanding of opportunity -36]: Guiguzi - flying clamp chapter - prevention against killing and bait
自定义组件、使用npm包、全局数据共享、分包
Huakaiyun | virtual host: IP, subnet mask, gateway, default gateway