Several days before, I raised a question to ask how using the keyword 'volatile' and I got the answer. Here I'd like to thanks again for the people who helped me. However, a new question rose in my mind about JMM that is currently I know there are main memory and thread own separate cache memory (maybe there are more professional terms for them), now I want to know what is stored in thread cache memory, the copy of shared object reference (the copy of object address) or the copy of shared object? For example, I declare an object B b = new B(); and b can be accessed by two threads then when b is accessed by the thread is the object reference b is copied and stored in thread own cache memory or is the object which b points to is copied and stored in thread own cache memory? Thanks.
Anything that be accessed by more than one thread could be in the "thread cache". That includes references if they are part of objects. It won't include references held in local variables as they are on the stack and can't be accessed from other threads.
So the answer is really "both".