What is the difference between a null array and an empty array?

前端 未结 4 535
傲寒
傲寒 2020-12-29 23:39

If the individual elements of an int array are not initialized, what is stored in them by default? I apparently found that there is something like an empty array or a null a

4条回答
  •  自闭症患者
    2020-12-30 00:18

    By default java initialized the array according to type declared. It is int then it is initialized to 0. If it is of type object like array of object then it is initialized to null.

提交回复
热议问题