POINT OUT DIFFERENCE BETWEEN SLEEP() AND WAIT() METHOD IN JAVA

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
 816  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    Point out difference between sleep() and wait() method in java

    The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!