Articles like this is where bad Java style comes from.

In real life you:

use commons APIs to check for empty objects, collections, etc;
treat exceptions like they are, well, exceptional and not like they are form of "if" statement;
never test Enumeration values for equality using object.equals();
dont use assert class like shown. You just add more complexity and gain nothing but exchange NPE for IAE.
and so on and so on. 



http://www.javacodegeeks.com/2012/06/avoid-null-pointer-exception-in-java.html
Shared publiclyView activity