Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between delete () method and deleteOnExit () method in Java.io.File

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "what is the difference between the delete () method and the deleteOnExit () method in Java.io.File". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn what is the difference between the delete () method and the deleteOnExit () method in Java.io.File.

1.delete () method:

When the delete () method is called, the file is deleted directly, regardless of whether the file exists or not, and is executed as soon as it is called

2.deleteOnExit () method:

When the deleteOnExit () method is called, it is only equivalent to making a declaration to deleteOnExit (), and when the program ends and JVM terminates, the deleteOnExit () method is actually called to implement the delete operation. That is, this method caches the deleted command for a while, and then operates when JVM stops.

This is all the content of the article "what is the difference between the delete () method and the deleteOnExit () method in Java.io.File? thank you for reading!" I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report