What is yielding and sleeping? how they different?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between this and super keyword?

521


How can you traverse a linked list in java?

670


What is difference between next () and nextline () in java?

530


Why string is immutable or final in java

601


What is heterogeneous in java?

484






can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread

528


What is the purpose of a transient variable?

574


What is a boolean structure?

549


What is difference between class and object in java?

521


What are Normalization Rules? Define Normalization?

543


What is getclass () getname () in java?

669


What is currentthread()?

564


What language is java written?

527


Explain garbage collection in java?

537


Explain about static nested classes in java?

602