Home > Java > "null", is this Object or not?

"null", is this Object or not?

November 26th, 2006 admin Leave a comment Go to comments

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.

Categories: Java Tags: , ,
  1. November 28th, 2006 at 22:56 | #1

    there’s also the Null object pattern which people often refer to, which is actually an object instance created that has default/empty compositions.

  1. No trackbacks yet.