2 August 2011

Good to know: about evaluation in java

When you do evaluation ( in if,for ,etc. ), it's good practice to check for null first ,before you check for other cases:

if(form.getUserCreditCardNumber() == null || form. getUserCreditCardNumber() == ""){
//bla bla bla
}

it helps you to avoid NullPointerException in weird and unexpected situation.

No comments:

Post a Comment