
Asked in AstraZeneca and 10 others
What is the difference between heap and stack memory in Java?

AnswerBot
3mo
Heap memory is dynamically allocated, while stack memory is used for static allocation and function calls.
Heap memory is managed by the programmer, while stack memory is managed by the compiler.
Stack ...read more
shubhakanta pradhan
1y
Heap memory is used by all the parts of the application whereas stack memory is used only by one thread of execution.
Anonymous
1y
In Java, the stack is used for static memory allocation, storing primitive data types and references within the scope of method calls, making access fast and automatic. The heap, on the other hand, is...read more
Rashmi
1y
The Stack memory is a sort of memory allocation that the OS continuously manages and uses to store local variables in a LIFO order. On the other hand, heap memory is a type of dynamic memory allocati...read more
Himanshu Sastry
1y
Stack Heap Memory
1
Basic
Stack memory is used to store items which have a very short life like local variables, a reference variable of objects
Heap memory is allocated to store objects and JRE classes....read more
Add answer anonymously...
Interview Questions from Popular Companies

3.7
• 8.7k Interviews

4.0
• 5.4k Interviews

3.5
• 4.2k Interviews

3.6
• 8k Interviews

3.7
• 5.9k Interviews

3.7
• 6.1k Interviews

3.5
• 4.2k Interviews

3.7
• 5.1k Interviews
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

