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

Can I override protected method in java?

1072


What is the relationship between clipping and repainting under awt?

1148


What is the use of math abs in java?

1010


What will happen if a thrown exception is not handled?

1016


What is a blocking method in Java?

1237


Is constructor inherited?

961


Difference between overriding and overloading in java?

1069


Why heap memory is called heap?

1042


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 ?

1161


Can inner class extend any class?

1055


Write a program to print fibonacci series

1154


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

1018


What is the purpose of nested class in java?

1083


What is difference between core java and java ee?

895


What are the types of java languages?

975