Thursday, 9 February 2017

COMPARISON BETWEEN YIELD(), JOIN() AND SLEEP() IN JAVA

yield()
join()
sleep()

To pause current thread execution to give chance to remaining waiting threads of same priority.

If a thread wants to wait until completing some other thread then we should go for join() method.
If a thread don’t want to perform any operation for a particular amount of time then we should go for sleep() method.

No comments:

Post a Comment