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


Please Help Members By Posting Answers For Below Questions

What are the advantages of java 8’s date and time api over old date api and joda time api?

605


What is flatmap in java8?

471


How do you run an executable jar file?

440


What is java persistence api used for?

429


How can one prove that the array is not null but empty?

483






What is java ioc?

458


What is lambda value?

468


Is java installed on windows 10?

450


What is ehcache in java?

469


Write a program for the problem: the array of inetegers indicating the marks of the students is given, U have to calculate the percentile of the students aaccording to this rule: the percentile of a student is the %of no of student having marks less then him. For eg: suppose Student Marks A 12 B 60 C 80 D 71 E 30 F 45 percentile of C = 5/5 *100 = 100 (out of 5 students 5 are having marks less then him) percentile of B = 3/5*100 = 60% (out of 5, 3 have markses less then him) percentile of A = 0/5*100 = 0%.

1671


What is stateless and stateful in java?

471


What is connection pooling in java?

496


What is meant by rest api in java?

450


What is meant by annotation in java?

461


Which interceptor is responsible for setting action javabean properties?

414