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

What is thread pool in java with example?

1067


What is length in java?

1066


What is hashtable and explain features of hashtable?

1049


What is void data type?

1057


How many bits is a string in java?

1080


How is it possible for two string objects with identical values not to be equal under the == operator?

1042


Difference between nested and inner classes ?

1195


Define reflection.

1055


Explain numeric promotion?

1166


how can you take care of mutual exclusion using java threads? : Java thread

1104


What is a map? What are the implementations of map?

1154


What are the concepts of 'OOPS'?

1122


What is encapsulation in java?

1175


Can we define static methods inside interface?

1035


What is the covariant return type?

1178