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
Can I override protected method in java?
What is the relationship between clipping and repainting under awt?
What is the use of math abs in java?
What will happen if a thrown exception is not handled?
What is a blocking method in Java?
Is constructor inherited?
Difference between overriding and overloading in java?
Why heap memory is called heap?
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 ?
Can inner class extend any class?
Write a program to print fibonacci series
When we serialize an object does the serialization mechanism saves its references too?
What is the purpose of nested class in java?
What is difference between core java and java ee?
What are the types of java languages?