What is the primary difference between heap and stack memory in Java?
Heap memory is where variables are stored, and stack memory stores methods and objects.
Iâ€™m disappointed with this answer. Itâ€™s actually the reverseâ€”stack memory stores method calls and local variables, while heap memory stores objects.
Can you explain how stack memory works during method execution in Java?