Sunday, 15 January 2012

Preventing NullPointerException -


I was researching ways to deal with NullPointerExceptions and three things that I found to be most useful:

  1. Request statement
  2. Comments (@Noall, @Null Worthy)
  3. "?." Using the example as a tap check example: If (MyRef! = Null) {MyRef.doSomething (); }

      The above code can be changed in: MyRef? .doSomething (); 
  4. >


No comments:

Post a Comment