Friday 5 July 2019

Compression of yield, join and sleep() method?


Property
Yield()
Join()
Sleep()
1) Purpose?
To pause current executing Thread for giving the chance of remaining waiting Threads of same priority.
If a Thread wants to wait until completing some other Thread then we should go for join.
If a Thread don't want to perform any operation for a particular amount of time then we should go for sleep() method.
2) Is it static?
yes
no
yes
3) Is it final?
no
yes
no
4) Is it overloaded?
No
yes
yes
5) Is it throws InterruptedException?
no
yes
yes
6) Is it native method?
yes
no
  • sleep(long ms) -->native
  • sleep(long ms,int ns)-->non-native



Thanks..!!

No comments:

Post a Comment