This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to test for null? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to test for null?" Watch "how to test for null?" New topic

how to test for null?

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146

I have got a doubt about null pointing object / instance test.

In general practice, how do a good programmer test for null values?

is it like :

OR is there any other method to test for null in java? like JUnit or "Sahi" kind of testing tool?

Please help me

With Regards,
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

It's very close from what you have written.

"a" and "null" can be on either side of the operator.

[My Blog]
All roads lead to JavaRanch
jQuery in Action, 2nd edition
subject: how to test for null?
Similar Threads
Object of Class N declared inside Class N itself.
null and not null in java
How to test singleton creation with JUnit
do and while