delete () method

Deletes a file directly when the delete () method is called, regardless of whether the file exists or not, and executes it as soon as it is called.

deleteOnExit () method

When the deleteOnExit () method is called, it is only equivalent to a declaration of deleteOnExit (), and the deleteOnExit () method is really called when the program is finished running and the JVM is terminated to achieve the delete operation. That is, the method caches the delete command for a while, and then performs the operation when the JVM stops