What is yielding and sleeping? how they different?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is 0 an irrational number?

693


Which collections are thread safe in java?

572


What does the three dot emoji mean?

679


Can we override a variable in java?

649


Can a class extend more than one class?

720






What is flush buffer?

624


What does java ide mean?

733


If an application has multiple classes in it, is it okay to have a main method in more than one class?

636


How many threads does a core java have?

611


Can we declare the main method of our class as private?

646


Why null value is used in string?

625


What do you mean by byte code?

602


What is java lang object?

599


How to compare strings in java?

585


What is the method to declare member of a class static?

636