Stack memory only contains local primitive variables and reference variables to objects in
heap space. Objects stored in the
heap are globally accessible whereas
stack memory can't be accessed by other threads. ... Because of simplicity in memory allocation (LIFO),
stack memory is very
fast when compared to
heap memory.
read more >>