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
What is a protected void?
When we serialize an object does the serialization mechanism saves its references too?
In the below example, how many string objects are created?
How can we make copy of a java object?
Which is better ascii or unicode?
What is identifier with example?
Is arraylist sorted in java?
please send me hr interview questions in it industry
What is heterogeneous in java?
What is java virtual machine and how it is considered in context of java’s platform independent feature?
How do you find the independent variable?
Can you pass by reference in java?
What is the effect of keeping a constructor private?
Does treeset allow null in java?
What is meant by stack and queue?