Archive for Object

“null”, is this Object or not?

Posted in Java with tags , , on November 26, 2006 by wsjoung

In java, some people say null is Object and they also use “null object” term when they try to explain something related in null like NullPointerException.

And some people simply show “null instanceof Object” result to prove that null is not Object. Of course it returns false for “null instanceof Object”. Because null is technically not Object.

The reason why people keep regarding null as a kind of Object is that they are confused those two terms, Object itself and Reference variable which points an object. Whenever they say “null object”, which means actually reference variable, and that reference variable assigned for a specific bit pattern which is for null.

Advertisements