+ 2
What' the differences between heap and stack memory in java
4 Respostas
+ 4
đđąđąđđš đđĄđđČđđ„ thank uđđ
+ 4
Avinesh thank uđđ
+ 2
Any object instantiated with a 'new' keyword gets memory allocated on the heap and the memory deallocation is taken care by the garbage collector in Java.
Also string literals are stored on the heap in a separate space known as String Constant Pool (SCP).
All the instance and local variables are allocated memory on the stack.
Also the stack memory is just few mb's whereas the heap is considered as infinite space of memory.