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 / modi[achir communication pvt.

Wait() : This function takes parameters as milliseconds and
puts the thread in wait state for the desired time of the
programmer after time passes the execution starts again.

Sleep() : This function is also used for same purpose using
his function by java you can put a thread in sleep state
.sleep does not contains any parameters so the thread will
not be automatically start execution It needs a wake up
signal again which can be Notify().or other function are
also provided by java.

So the main difference in Wait() and sleep() is wait takes
time parameter and wait for specific time only and sleep
throws a thread in sleep mode for unspecified time.

Is This Answer Correct ?    6 Yes 105 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is a method a procedure?

1048


what is session in java?

1247


What is singleton class example?

1024


What is the difference between replace and replace all?

1021


Why stringbuilder is not thread safe?

1030


How define set in java?

1073


What is the static field modifier?

1124


Explain about member inner classes?

1098


Why arraylist is not synchronized in java example?

1058


Convert a BST into a DLL and DLL to BST in place.

1111


What is JVM and is it platform independent?

1046


Can I uninstall java?

1047


Can we store variables in local blocks?

1347


What are the actions that can occur when a thread enters blocked state?

1056


Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?

1158