In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the difference between sleep () and yield () in Java programming language". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the difference between sleep () and yield () in Java programming language".
1) sleep () brings the current thread into a stagnant state, so the thread executing sleep () will definitely not execute within a specified period of time; yield () just brings the current thread back to the executable state, so the thread executing yield () may be executed again as soon as it enters the executable state.
2) sleep () can give low-priority threads the opportunity to execute, of course, it can also give the same priority and high-priority threads the opportunity to execute; yield () can only make the same priority threads have the opportunity to execute.
Class TestThreadMethod extends Thread {public static int shareVar = 0; public TestThreadMethod (String name) {super (name);} public void run () {for (int iTuno; I)
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.