There are reasons for preferring
if (null == value) in C/C++ because you will get a compiler error if you write
= by mistake instead of
==. That is because C cannot distinguish 0 for
false and 0 for
null and will accept
(value = null) as the same as
false. Only in C you usually say
NULL, rather than
null. But you can't write
if (NULL = value) even in C.
In Java, however, the compiler will never allow
if (null), so you will always get a compiler error if you write
if (value = null) instead of
== null. In that case there is no need to prefer
if (null == value) and I would agree with Maneesh and Manish.
You should, however, always avoid
== false and
== true, because it is possible to change values with
= unintentionally.