I have a question about the fol from JQuest Mock Exam
Read the following snippet carefully
1. public synchronized void someMethod() {
2. //lots of code
3. try {
4. Thread.sleep(500);
5. } catch(InterruptedException e) {
6. //do some things here.
7. }
8. //more and more code here
9. }
Select all correct answers
a) //ignored
b)The
Thread sleeps at least 500ms if not interrupted.
c) when thread go to sleep,it release the lock on the object.
d)The "sleeping" threads always have the lock on the object.
question:
why the answer are c) and d)
I chose b) and c)
I think c) conflicts with d)
Can anyone explain this?
Thx in advance.