Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Synchronized block

807598Jan 12 2006 — edited Jan 12 2006
The syntax of a synchronized block is
synchronized (object) {
 <code>
}
As far as I could understand, two different threads will compete - even if cooperating - on the use of <code>. What about the object? I think that it is some sort of reference to the monitor and that two synchronized blocks with the same object must be understood as the same monitor but is it "synchronized" too? In other words, what happens to code outside the monitor if it references the object?

Thanks,

Ricardo
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 9 2006
Added on Jan 12 2006
4 comments
69 views