Originally posted by aymen esawey:
hi
having a synchronized method inside of a synchronized code block is of no use , as only ONE thread is allowed to execute
the code inside of the synchronized block
Yes you are right is of no use having sync menthod inside sync block....
but point is this .. on which object we have obtained the lock ...
as run is not sync... and lock is on obj.. which has no sync method ... then other thread's run method can execute whenever JVM schedules it as it won't need monitor..
I think objcet which is locked (either by making instant method to be sync or sync the object).. that object's sync method can not be executed.
CMIW