Infosys Interview Question
Software Engineer / Developersbasically yield method is responsible for killing of thread in general. When some thread is blocked ( in java 5 you can get the state of thread by calling get state ) and calling interrupt and then wait for few milliseconds and check if thread is alive or not .. if not // yield it .. it will tell the thread to leave the resources which thread is acquired (object locK) and let the other threads of same priority to come and execute the task
yield method stops the currently running thread and allows any other waiting thread to start running.
- Anonymous September 05, 2011