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
What is the java api?
What do you understand by casting in java language? What are the types of casting?
What is jep in java?
I get an exception if I remove the static modifier from main?
What is numberformatexception in java?
How do I download and install eclipse on windows 10?
What are microservices in java?
What is meant by framework in java?
What is the use of jprofiler?
Why do we only use the main method to start a program?
How do I enable java in google chrome?
Can the main method be overloaded?
What is meant by pass by reference and pass by value in java?
Why bean class is used in java?
1.can i use super keyword in normal class(not inheritance) to call any method?if so how can i call particular variable? 2.In the inheritance how can i access the particular variable from the base class(it containing 5 variables) using super keyword?