Java - is `null` an instance of `object`?

前端 未结 7 1356
清酒与你
清酒与你 2021-01-07 16:36

I read that null isn\'t an instanceof anything, but on the other hand that everything in Java extends Object class.

相关标签:
7条回答
  • 2021-01-07 16:59

    As the JLS says, null is of the null type and that is not a reference type. It is however usable in situations where a value of a reference type is expected (the value is really a “bottom” in the type algebra).

    0 讨论(0)
提交回复
热议问题