当前位置:网站首页>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 ");
}
}
}边栏推荐
- [data mining] task 4:20newsgroups clustering
- Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance o
- Network security - dynamic routing protocol rip
- STM32 - vibration sensor control relay on
- 浏览器是如何对页面进行渲染的呢?
- 7-25 read numbers (loop switch)
- mysql
- [leetcode] 797 and 1189 (basis of graph theory)
- [camera topic] turn a drive to light up the camera
- 网络安全-openvas
猜你喜欢

Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day

【數據挖掘】任務6:DBSCAN聚類
![[North Asia data recovery] data recovery case of raid crash caused by hard disk disconnection during data synchronization of hot spare disk of RAID5 disk array](/img/2a/98400b0d0b5eda1e52abae30746f2b.jpg)
[North Asia data recovery] data recovery case of raid crash caused by hard disk disconnection during data synchronization of hot spare disk of RAID5 disk array

【Camera专题】手把手撸一份驱动 到 点亮Camera
![[error record] an error is reported in the fluent interface (no mediaquery widget ancestor found. | scaffold widgets require a mediaquery)](/img/fd/d862412db43a641537fd67f7910741.jpg)
[error record] an error is reported in the fluent interface (no mediaquery widget ancestor found. | scaffold widgets require a mediaquery)

STM32 - introduction of external interrupts exti and NVIC
![[fluent] hero animation (hero animation use process | create hero animation core components | create source page | create destination page | page Jump)](/img/68/65b8c0530cfdc92ba4f583b0162544.gif)
[fluent] hero animation (hero animation use process | create hero animation core components | create source page | create destination page | page Jump)

The technology boss is ready, and the topic of position C is up to you

【Camera专题】OTP数据如何保存在自定义节点中

mysql
随机推荐
[data mining] task 1: distance calculation
Installation and use of serial port packet capturing / cutting tool
Network security - DNS spoofing and phishing websites
STM32 - Application of external interrupt induction lamp
[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
深度(穿透)选择器 ::v-deep/deep/及 > > >
Analyzing several common string library functions in C language
Function definition and call, this, strict mode, higher-order function, closure, recursion
技术大佬准备就绪,话题C位由你决定
[data mining] task 2: mimic-iii data processing of medical database
网络安全-钓鱼
Steps to obtain SSL certificate private key private key file
word插入公式/endnote
PS去除水印详解
Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly
Network security - password cracking
网络安全-动态路由协议RIP
Take you ten days to easily complete the go micro service series (I)
网络安全-浅谈安全威胁
2022 financial product revenue ranking