# Is there a difference between null and NULL?

**URL:** <https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523>\
**Category:** Scripts & Rules\
**Created:** [July 8, 2018, 7:27am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523 "2018-07-08T07:27:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carsten](https://community.openhab.org/user_avatar/community.openhab.org/carsten/32/39696_2.png) [@carsten](https://community.openhab.org/u/carsten)\
**Post date:** [July 8, 2018, 7:27am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523/1 "2018-07-08T07:27:54Z")

</div>

After switching to openhab 2.3 and re-engineering all my KNX items and things I had some strange behaviors with some rules. Deep diving I found ItemStateEvents that change the state of an item from null to NULL. Working with a lot of hash maps in my rules I have a lot of If statements that filter items states that contains a null (!== null). As I’m not an expert in Java I was wondering if there is a difference between null and NULL and in which use-case I need to check whether a “null” or a “NULL” state of an item.

Hope someone can bring some light into this 🙂

Carsten

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [July 8, 2018, 7:36am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523/2 "2018-07-08T07:36:21Z")

</div>

> [@After openhabe 2.3 update, homematic binding don't update item status](https://community.openhab.org/t/after-openhabe-2-3-update-homematic-binding-dont-update-item-status/46070/4):
>
> Not quite right. null !== NULL NULL is an Object of type State and it is a special State Items can have to indicated the Item is uninitialized. As an Object, NULL does have a .equals method so == should be used. null is a primitive speical work in the programming langauge to indicate no value. As a primitive, null does not have a .equals method so one should use the identity operator === instead of the equivalency operator ==. So === and !== should only be used with null and never used with N…

> [@\[SOLVED\] Error in rules (Cannot reference the field 'NULL' before it is defined)](https://community.openhab.org/t/error-in-rules-cannot-reference-the-field-null-before-it-is-defined/33504/6):
>
> NULL != null NULL is a special State that an Item can have to indicate it is uninitialized. null is a programming construct that means no value. The two are distinct be and not interchangeable.

---

<div class="post-metadata">

**Author:** ![carsten](https://community.openhab.org/user_avatar/community.openhab.org/carsten/32/39696_2.png) [@carsten](https://community.openhab.org/u/carsten)\
**Post date:** [July 8, 2018, 7:56am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523/3 "2018-07-08T07:56:09Z")

</div>

Great! thx for clarification. Could not really use the search function on this or I was too stupid to run the search case sensitive

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [July 8, 2018, 8:02am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523/4 "2018-07-08T08:02:36Z")

</div>

> [@carsten](#):
>
> Could not really use the search function on this

Just include @rlkoshak in your searches and you will find almost any solution 😀

---

<div class="post-metadata">

**Author:** ![carsten](https://community.openhab.org/user_avatar/community.openhab.org/carsten/32/39696_2.png) [@carsten](https://community.openhab.org/u/carsten)\
**Post date:** [July 8, 2018, 8:07am UTC](https://community.openhab.org/t/is-there-a-difference-between-null-and-null/47523/5 "2018-07-08T08:07:44Z")

</div>

Yes I know 🙂

Root cause for the strange behavior found: I used find+replace function to replace != null to !== null in my rules. I think that operation was not done case sensitive and it was also replaced for the states. Maybe a good learning for others who switch to 2.3
