I have been writing Java for money for more than ten years and never ever have I had non-trivial problems with null. Less than one percent of the bugs I fixed were caused by nullpointers, less than one percent of write-deploy-test loops were caused by it. I either have code that can't be null (e.g. getters of lists that create a list if the field is null, outright validation before usage), code where null has a desir…
There are patterns that experienced developers will use to avoid issues with nulls. Here are a couple off the top of my head. 1) Reversing string comparisons: "literal".equals(variable) instead of variable.equals("literal") 2) Always initializing lists instead of leaving them to default to null public class SomeClass{ private List someList=new ArrayList(); //or Collections.emptyList() ... } The problems with NullPoin…
Everyone should know these things by now. They are good things to ask about in interviews.