Details of this blog In the class library createNewFile() method

public class CreateNewFileTest { public staticvoid main(String[] args) { File
f = null; boolean bool = false; try { f =new File("study.txt"); bool =
f.createNewFile(); System.out.println("file Exist?" +bool); bool = f.delete();
System.out.println("file Exist?" +bool); bool = f.exists();
System.out.println("file Exist?" +bool); } catch (IOExceptione) {
e.printStackTrace(); } } }

output :

file Exist?true

file Exist?true

file Exist?false

analysis :

File file = new File("xx"); Represents a file under a path

createNewFile() return boolean, Indicates whether the file was created successfully

file.delete() return boolean, Indicates that the file was deleted successfully

f.exists() return boolean, Indicates whether the file exists

©2019-2020 Toolsou All rights reserved,
Bitcoin in ten years ,VDS Opportunity or fraud Don't annoy the panda with any cat !「 Kung Fu Panda 」20 It's the year of man 4 blood sort ( one ) bubble sort Random forest R Language implementation java Realize the function of grabbing red packets Python Basic knowledge and notes python To solve the problem of dictionary writing list in CSS architecture design Vue Common features ( one )2021 year 2 Monthly programmer salary statistics , average 15144 element