diff b/w sleep(1000) and wait(1000)?

Answer Posted / rajani nagandla

The sleep method is used when the thread has to be put
aside for a fixed amount of time. Ex: sleep(1000), puts the
thread aside for exactly one second. The wait method is
used to put the thread aside for up to the specified time.
It could wait for much lesser time if it receives a notify
() or notifyAll() call. Ex: wait(1000), causes a wait of up
to one second. The method wait() is defined in the Object
and the method sleep() is defined in the class Thread.

Is This Answer Correct ?    44 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If try block is successfully executed, Then Is Finally block executed?

602


Where are local variables stored?

507


What is a line separator in java?

533


Which access specifier can be used with class ?

528


What do you mean by scope of variable?

477






what is interface in java? Explain

525


Java is Pass by Value or Pass by Reference?

616


What is replaceall in java?

541


how to one war file class to another war file class?

1550


Explain java coding standards for methods?

597


Can inner class final?

627


What do you mean by of string::valueof expression in java 8?

533


Explain about the interpreter in java?

617


What is the purpose of main function in java?

531


Which graphs are functions?

488