WHAT IS DIFFERENCE BETWEEN WAIT() AND SLEEP() METHOD?

Mayank Tripathi

Total Post:807

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

    Post:807

    Points:4035
    What is difference between wait() and sleep() method?

    wait()
    1) The wait() method is defined in Object class.
    2) wait() method releases the lock.

    sleep()
    1)The sleep() method is defined in Thread class.
    2)The sleep() method doesn't releases the lock.

Answer

NEWSLETTER

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