Method Stage 1 Language Basics + Advanced _1-3-Java language classes and senior _06-File IO streams _01 File class to create a class _7_File delete function





createNewFile()


createNewFile throws an exception



throws an IO exception

all the time we call the method must handle exceptions

throws the exception

return to true

finally create a good file

to execute code again. File already exists it will not be repeated again create

a relative path


to create a good file

path to write the path to a folder

actually create good or a file, not a folder


path does not exist to create the file. Will error
 

mkdir create folders and mkdirs

mkdir can only create single-level folders
mkdirs, you can create multilevel or you can create a single stage





to create a folder good


pass more than one level of folders


mkdirs








    

nonexistent path

path does not exist will not be created

Delete

  
Here's the new folder deleted.




After the deleting directories






 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11263972.html