What is yielding and sleeping? how they different?
Answers were Sorted based on User's Feedback
Answer / ranganathkini
When a thread yields, its execution is paused and loses
ownership of the monitor lock giving other waiting threads a
chance to run.
When a thread sleeps, its execution is paused for the
specified duration during such an idle period, the thread
continues to retain the ownership of the monitor lock.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / ravikiran
yield() method will suspend all the same priority thread
which is running and gives chance to next thread to run
which is of the same priority
sleep() method will make the thread to sleep for a
particular period of time which is specified in the
argument list
| Is This Answer Correct ? | 1 Yes | 2 No |
What do you mean by jjs in java8?
What is finally in exception handling?
What is preparedstatement in java?
what is encapsulation in java? Explain
Is string an object?
Can we convert list to set in java?
What causes memory leak in java?
take any 4 input numbers. like 2345.. wanted out put is All 16 combinations of the number 2345.. for example- taking input as 4565 output- 5654 4556 4655..
What does split function do in java?
How variables are stored in memory?
Why java is made?
What are thread groups?