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

Answer Posted / vinay kumar

sleep() will wait go to sleep for amount of time that is specified in it.After the times finishes it resumes automatically.

wait() will also wait for some I/O and will NOT resume automatically but will resume only when notify() or notifyall() is called.

Is This Answer Correct ?    19 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write custom exception in java?

595


How do you remove spaces in java?

530


Explain about member inner classes?

580


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

516


What are the different data types in java?

526






What are keywords in java?

571


How large is a boolean?

549


Can we override private methods?

538


What is valid keyword in java?

545


what is method reference in java 8?

550


Why put method is used?

519


What is a singleton class? Give a practical example of its usage.

583


How many types of variables are there?

663


How does remove work in java?

513


What is the difference between a static and a non-static inner class in java programming?

521