How are static arrays stored in Java memory?

前端 未结 7 1959
名媛妹妹
名媛妹妹 2021-02-18 21:33

So in a language like C, memory is separated into 5 different parts: OS Kernel, text segment, static memory, dynamic memory, and the stack. Something like this:

7条回答
  •  粉色の甜心
    2021-02-18 21:52

    You are creating a new array, not modifying the old one. The new array will get its own space and the old one will be garbage-collected (so long as nobody else holds a reference to it).

提交回复
热议问题