JMM: Java Memory Model
The program has a main memory space. And each thread has its own space.
Shared values are copied from the common space to the threads’ own spaces.

Two Issues in JMM:
Visibility
Ordering

Synchronize solve both of them.
volatile only solve visibility. It makes changes to the value directly on the common space so that the change is visible to all the threads. But it does not guarantee read and write to be an atomic operation. It fits to situations like:
volatile int value;
public void setValue(int i)
{
   value = i;  // not fit when value = value + i;
}

reference: http://www.iteye.com/topic/806990




String and Constants Pool
String a = “abc”;                           (a)
String a = new String(“abc”);        (b)
a.intern();                                      (c)
(a). “abc” would be put into the constant Pool and a point to it.
(b). 2 string instances are initialized, one is in the constant pool, another one is a.
(c). extend the constant pool, adding the current value of a into it. if the value already exists, then return the reference to this object.

reference: http://blog.csdn.net/cutfield/article/details/7340648