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 are the advantages of exception handling?
What is difference between string and stringbuffer?
Can we sort hashmap in java?
Can a constructor be protected?
What is the latest java version?
What is a default method?
What is javac in java?
What is singleton service?
How is string immutable in java?
How do you sort arrays in java?
How we create object in copy constructor?
What is the purpose of checked and unchecked exceptions in JAVA?
What is finally and finalize in java?
What is an i/o filter?
What is string intern in java?