Java String judgement for null value.


Work by Jianfei is licensed under a Creative Commons wei 3.0 Unported License.

 

It's better to take a look this code line in below, before we using a judgement code statement to verify a string value

 

 

1 :   if  ( ( objectA.getStringValue()  !=   null &&  (objectA.getStringValue().length()  !=   0 ) )

2 if  (objectA.getStringValue().length()  !=   0 &&  ( objectA.getStringValue()  !=   null

 

 

After run those code command in java, you will see an exception for code line 1 . But the code line 2 is passed. So the 

sequential execution in java for expression AND is very important for us.


Work by Jianfei is licensed under a Creative Commons wei 3.0 Unported License.

 

你可能感兴趣的:(java String)