Tuesday, September 8, 2009

Comparison In JAVA

Method 1
if(object.equals(null))   --> will return false
but,
Method 2
if(.equals(object) )  --> will return null


conclusion is, when running comparison, please use the Method 1
to avoid from the system throw the Null Pointer Exception

No comments:

Post a Comment