why the sleep method does not leave the lock and wait method
leave the lock
Answer Posted / amit singh
every class has an object lock but when you used
synchronized block or synchronized method
means to say the when you use synchronized keyword then the
object lock come in an existence without you don't get the
lock on particular object you
must know that wait()
1) what is the purpose of when you call wait on the object
which lock you get when you use synchronized block or method
then particular thread immediate leave the
lock so means to say that wait must to use when you get the
lock on the particular object without
2)its your turns to think that there is any mendotary
to call Thread.sleep() method in synchronized block
so whe there is no relation b/t sleep and Monitor(i'm saying
lock on the object)
why youthink it like that why the sleep() doesn't leave the
lock and wait() leave the lock
3) ther is no realtion between object lock and sleep
amit singh
amitsing2008@gmail.com
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Are jvm’s platform independent?
What is mime in java?
How do I install java on windows?
What is a stream in programming?
Why is class forname used in java?
What are jdk tools?
What is @override annotation in java?
What is singleton pattern in java?
Can I have multiple main methods in the same class?
What type of parameter passing does java support?
What is the use of flatmap?
What are the advantages of lambda functions?
How do you type the lambda symbol?
What is cache in java?
What is data persistence in java?