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 part of memory - Stack or Heap - is cleaned in the garbage collection process?
Tell me the latest versions in java related areas?
What is annotation in java?
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
0 Answers HCL, SAP Labs, Vital Soft,
What does super()represent, and how is it used in Java?
How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
How can you traverse a linked list in java?
How to invoke external process in java.
What is static synchronization?
What is argument in java?
What is Java Package and which package is imported by default?
Which is faster string or stringbuilder?