Synchronized keyword lock object. The object is locked inside the Synchronized code, which does this object and what you have made by your object reference? Synchronous processing for an object is only locked. However, you must be aware that don't reassign object references to the locked object. So what happens if this happens? Consider the following code, it implements a Stack: class stack {private int stcksize = 10; private int [] INTARR = new int rt [stacksize]; private int index; // stack's next available location. Public void push (int val) {synchronized (INTARR) {// If full, you will reassign an integer array (ie our stack). IF (index == INTARR.LENGTH) {stacksize * = 2; int [] newinTarr == new int [stacksize]; System.ArrayCopy (INTARR, 0, NewIntarr, 0, INTARR.LENGTH); INTARR = newIntarr;} INTARR [index] == Val; index ;}} public int pop () {int RetVal; synchronized (intarr) {if (index> 0) {RETVAL = INTARR [index-1]; // retrieved value, index--; / / And reduce STACK by 1 value. Return Retval;}}............................. An array of initial size is created to accommodate an integer value. This type implements the PUSH and POP methods to simulate the use of stack. In the PUSH method, if there is no more space in the array to accommodate the crimped value, the array is reassigned to create more storage space. (Expensive Did not use Vector to implement this class. The basic type can not be stored in Vector.) Please note that this code is to be accessed by multiple threads. The PUSH and POP methods are completed within the Synchronized block each time the access of the shared instance data of the class is completed. This ensures that multiple threads cannot be concurrently accessing this array and generate incorrect results. This code has a major disadvantage. It works synchronously for integer array objects, and this array is referenced by the Stack class's INTARR. This disadvantage is revealed when the Push method is reassigned this integer array. When this happens, the object reference INTARR is reset to reference a new, larger integer array object. Note that this is happening during the execution of the SYNCHRONIZED block of the PUSH method. This block is synchronously processed for the object referenced by the INTARR variable. Therefore, the objects that are locked in this code are no longer used. Consider the following event sequence: Thread 1 calls the Push method and obtain the lock of the INTARR object. Thread 1 is first robbed. Thread 2 calls the POP method. This method is blocked by the same lock held by the current thread 1 in the PUSH method. Thread 1 Re-control and reassign an array. The INTARR variable now references a different variable. The Push method exits and releases its lock to the original INTARR object. Thread 1 calls the PUSH method again and obtains the lock of the new INTARR object. Thread 1 is first robbed. Thread 2 obtains an object lock of the old INTARR object and attempts to access its memory. Now thread 1 holds the lock of the new object referenced by INTARR, thread 2 holds the lock of the old object referenced by INTARR.