Why does Java uses heap for memory allocation?

前端 未结 7 524
别那么骄傲
别那么骄傲 2020-12-09 11:15

I just read this statement in a java book saying Objects in java reside on a heap. Is a heap used because it is the best way to store data and retrieve data fast ?

7条回答
  •  时光取名叫无心
    2020-12-09 11:25

    Why not store objects on the stack? Well, what happens to the stack after the currently executing method stops executing?

提交回复
热议问题