What is the differences between Heap and Stack Memory in Java? Explain
Heap space | Stack Memory | |
---|---|---|
1. | Used to allocate memory | Used for execution of the thread |
2. | Instance variables are created | Local variables are created |
3. | Contains Objects and reference variables | Contains methods and local variables |
BY Best Interview Question ON 13 Jan 2019