What is null in Java?

后端 未结 14 1574
陌清茗
陌清茗 2020-11-21 20:49

What is null?

Is null an instance of anything?

What set does null belong to?

How is it represented in the me

14条回答
  •  不要未来只要你来
    2020-11-21 21:17

    Short and precise answer which answers all your questions formally from JLS:

    3.10.7. The Null Literal

    The null type has one value, the null reference, represented by the null literal null, which is formed from ASCII characters.

    A null literal is always of the null type.

    Only a reference of type which is assigned to null is allocated. You don't assign any value (object) to the reference. Such allocation is specific to JVM how much reference will take and in which memory area it will be allocated.

提交回复
热议问题