- Yield() method causes to pause current thread execution to give the chance for waiting thread of the same priority.
- If the there is no waiting thread or all waiting threads have low priority, then same thread continue its execution.
- If multiple threads are waiting with the same priority, then which thread will get the chance. We can’t expect.
- It depends on thread-scheduler.
- The Thread which is yield, when it will get the chance once again. It depends on Thread-schedular and we can expect exactly.
public static native void Yield();
Native methods are not implemented in java. It is implemented in non-java.