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
What is the use of System class?
Detail discussions on JVM, memory management and garbage collector.
How will you get the platform dependent values like line separator, path separator, etc., ?
How many inner classes can a class have?
What is a predicate method?
Difference between static and dynamic class loading.
what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread
What do you understand by abstract classes?
What happens when a thrown exception is not handled?
What causes memory leaks in java?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
Explain about the interpreter in java?
Compare Mutex and Semaphore in java.
Can we define package statement after import statement in java?
What is lexicographically smallest string?