Explain the purpose of yield method.
Yield method causes the currently executing thread object to temporarily pause and allow other threads to execute
Syntax:Public static void yield()
When a thread executes a thread yield, the executing thread is suspended and the CPU is given to some other runnable thread. This thread will wait until the CPU becomes available again.