Is null an Object?

2019-01-04 19:22发布

Is null an Object in Java?

标签: java null
15条回答
祖国的老花朵
2楼-- · 2019-01-04 19:42

No ,null is not an object.It is a reference type and its value does not refer to any object and so there is no representation of null in memory.

查看更多
虎瘦雄心在
3楼-- · 2019-01-04 19:46

No, it's not an instance of a Class nor a Class. It's a reference to nothing.

Edit: haven't read the spec so the above may not be 100% accurate.

查看更多
做个烂人
4楼-- · 2019-01-04 19:49

Absolutely not: null instanceof Object returns false.

查看更多
登录 后发表回答