From the general direction to divide:
Stack memory, heap memory, method area, local method stack, program counter
Java is divided from the point of view of storing data:
Register: The fastest storage area, allocated by the compiler on demand, is not considered controlled.
Stack (STATCK): holds the base data type and the reference alias
Heap (Heep): New comes out of something
Static storage: Static members are stored statically defined
Constant storage: (Constant storage): Holds string constants and basic type constants (final)
Non-RAM Storage
For strings: References to objects are stored in the stack if they have been created at compile time and stored in a constant pool if the runtime (new) is determined to be stored in the heap.
For strings equal to equals (string values equal), there is always only one copy in the constant pool, which can have multiple copies in the heap.
Java--Virtual machines and memory