A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Yield() method

  • 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. 
Complete prototype:
public static native void Yield(); 
Native methods are not implemented in java. It is implemented in non-java.