Skip to content
Related Articles

Related Articles

Improve Article

Comparison of yield(), join() and sleep() in Java

  • Last Updated : 27 May, 2018
Geek Week

Comparison table yield(), join(), sleep()

purposeIf a thread wants to pass its execution to give chance to remaining threads of same priority then we should go for yield()If a thread wants to wait until completing of some other thread then we should go for join()If a thread does not want to perform any operation for a particular amount of time, then it goes for sleep()
Is it overloaded?NOYESYES
Is it final?NOYESNO
Is it throws?NOYESYES
Is it native?YESNOsleep(long ms)->native & sleep (long ms, int ns)-> non native
Is it static?YESNOYES

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :