While executing following code, I am getting NullPointerException at lineIn earlier lines when I use null instead of getDouble() everything works and this is strange.
This question already has an answer here:Just found out, that I get a NullPointerException when trying to split a String around +, but if I split around - or anything else (and change the String as well of course), it works just fine.
Why does the following throw a NPE? Is this some syntactical sugar for c.equals(' ')?Not exactly. The operation c == ' ' is equivalent to c.charValue() == ' ', so when charValue() is invoked on null, a NullPointerException is thrown.