Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Question 24
A Thread can become the owner of an object's monitor by which three of the following?
a. By invoking the sleep method on the Thread.
b. By entering any synchronized static method of the Thread class.
c. By blocking on IO.
d. By entering a synchronized instance method.
e. By invoking the wait method on the Object.
f. By entering the body of a block that is synchronized on the Object.
g. By entering a synchronized static method of a class of type Class.
h. By invoking the notify method on the Object.
i. None of the above.
A Thread can become the owner of an object's monitor by entering a synchronized instance method.
A Thread can become the owner of an object's monitor by entering a synchronized instance method that is a member of the object in question.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
A Thread can become the owner of an object's monitor...?
g. By entering a synchronized static method of a class of type Class.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
A Thread can become the owner of an object's monitor by which two of the following? Please assume the object is not an instance of type Class.
a. By invoking the sleep method on the Thread.
b. By blocking on IO.
c. By entering a synchronized instance method of the Object.
d. By invoking the wait method on the Object.
e. By entering the body of a block that is synchronized on the Object.
f. By entering a synchronized static method of the Object.
g. By invoking the notify method on the Object.
h. None of the above.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Originally posted by Dan Chisholm:
If a thread invokes a static method on c1 then it will obtain the lock on the instance c1.
I think that answer option g is beyond the scope of the real exam so I think that I will remove it.
Originally posted by Pradeep Bhat:
Hi Dan,
I understand When the Class object of an object
is obtained and then the static sychronized method is invoked ..In effect the "class" lock (not the instance)lock is obtained.
Let me know in case I am wrong.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |