How are static arrays stored in Java memory?

前端 未结 7 1932
名媛妹妹
名媛妹妹 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 22:06

    In Java you've merely asked that a strongly typed reference to an array be stored statically for the class Test. You can change what a refers to at runtime, which includes changing the size. This would be the C equivalent of a static storage of an int*.

提交回复
热议问题