Property | yield() | join() | sleep() |
---|---|---|---|
Purpose | If a Thread wants to pass its execution to give the remaining Thread the same priority, then. We should go for yield(). | If a Thread wants to wait until the completion of some other Thread, then we should go for join(). | If a Thread doesn’t want to perform any operation for a particular amount of time then we should go to sleep() |
Is it overloaded? | No | Yes | Yes |
Is it final? | No | Yes | No |
Is it throws an Interrupted Exception? | No | Yes | Yes |
Is it native? | Yes | No | sleep(long ms) native sleep(long ms, int ns) nonnative |
Is it static? | Yes | No | Yes |
Similar Java Tutorials
- Odd Even in Java
- Method to print exception information in Java
- Exception Handling by Using try-catch in Java
- Checked Exception vs Unchecked Exception
- Exception Hierarchy in Java
- Java Exception Handling Interview Questions
- final finally finalize in java
- User Defined Exception in Java
- Exception Handling Keyword in Java
- throw throws in Java
- try with multiple catch block in Java
- Threads in Java
- Thread priority in Java