What are the difference between heap and stack memory in java ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What are the difference between heap and stack memory in java ?

24th Jul 2019, 4:10 AM
Govardhan Nayak
Govardhan Nayak - avatar
2 Answers
+ 5
The Stack is the part in memory where local variables and function calls space is allocated. Thats why if you create a recursive function without a base case you will get a StackOverFlowError in java as each call takes up more of the available space of the stack until it runs out The Heap is where objects are stored. i am very limited here so you can search the web also
24th Jul 2019, 4:49 AM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
+ 1
Stack is a static memory, where heap is a dynamic memory
6th Sep 2019, 5:54 AM
Pooja K.R.