Java - Static and Dynamic Array Initialization

后端 未结 3 700
[愿得一人]
[愿得一人] 2021-01-05 20:02

Is it true that every array that is initialized during runtime is dynamic and every array that is initialized during compiling is static?

for example:



        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 20:31

    Yes,The size of an array come to know at compile time only but allocation of memory will happen at runtime. Until you encounter 'new' memory won't be allocated to array.

提交回复
热议问题