Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the difference between sleep() and Wait()?

Answer Posted / tisty

Simply speaking, we will use sleep() for pausing a thread
intentionally for some amount of time which we mentions in
milliseconds as the argument of sleep() method and,
wait() method is used whenever there is a communication is
needed between the threads, say if one thread's execution
is depended on the the execution of others.

The thread went on sleep will continue its execution after
the timeperiod. on the other hand, the thread undergone
wait will get activated on a notify() or notifyall() method.

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why hashmap is used in java?

1088


Can we store variables in local blocks?

1346


Does sprintf allocate memory?

1102


Why singleton class is used in java?

1124


Why string is called as immutable?

944


Why is java called the platform independent programming language?

1004


What isan abstract class and when do you use it?

1591


Explain about anonymous inner classes ?

1074


What is Java Reflection API? Why it’s so important to have?

1155


What is method overloading in JAVA? Why is it not present in C ?

1099


What is the difference in between cpp and java? Can u explain in detail?

1089


How do you remove all elements from an arraylist in java?

1020


What will happen to the exception object after exception handling?

992


What about instanceof operator in java?

1017


How is a variable stored in memory?

1002