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 / kumaran

thread.sleep(2000) - this will block the thread exactly 2000
milliseconds.

thread.wait(2000) - this will block the thread upto 2000
milliseconds.

i.e if thread.notify() calls before 2000 milliseconds, the
thread will become active incase if the thread is blocked by
wait().

Is This Answer Correct ?    14 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a protected void?

983


When we serialize an object does the serialization mechanism saves its references too?

1081


In the below example, how many string objects are created?

1098


How can we make copy of a java object?

1222


Which is better ascii or unicode?

1047


What is identifier with example?

1096


Is arraylist sorted in java?

1063


please send me hr interview questions in it industry

2173


What is heterogeneous in java?

1026


What is java virtual machine and how it is considered in context of java’s platform independent feature?

1225


How do you find the independent variable?

1131


Can you pass by reference in java?

1034


What is the effect of keeping a constructor private?

1004


Does treeset allow null in java?

1011


What is meant by stack and queue?

1126