This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design 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: 14688

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
I agree. Here's the link:
subject: how to test for null?
It's not a secret anymore!