Tag: INF exists in text sources file read/write Res path property
The file class contains the properties for obtaining a file/directory, as well as a method for renaming and deleting files/directories.
The file class contains many methods for getting file properties, as well as methods for renaming and deleting files and directories, but the file class does not contain methods to read and write the contents of files
The file object encapsulates the properties of the files or paths, but he does not include the method of creating the file or the method of reading/writing the data from/to the file.
File input and output
Write Data using PrintWriter
The PrintWriter class can be used to create a file and write data to a text file.
You can create a PrintWriter object first, and then call the print, println, and printf methods to write data to the file
The usual methods are as follows:
Example:
You must use the close () method if it is not used, the data is not saved correctly in the file.
Using try-with-resources to automatically close resources
Java I/O processing