basically when you talking about memory management,
there are two types of memory one is stack and another is heap memory.
When you write A = 10 in programming languages
here A is known as Referance variable which is stored in Stack Memory
and 10 is known as Object which is stored in Heap Memory.
so here reference variable 'A' in stack is pointing towards object '10' in heap memory
Stack is used for static memory allocation meaning memory is allocated at compile time before the program executes.
Heap is used for dynamic memory allocation meaning the memory can be allocated and freed in random order.
compare to stack, objects in the heap are much slower to access.
Stack follows the Last in, first out order whereas Heap does not follow any order.
stack stores items that have a very short life such as methods, variables, and reference variables of the objects.
Heaps stores objects and Java Runtime Environment classes.
stack,heap,java,core java, LIFO, Memory managmenet, Stack Overflow, Stack heap, Object