阅读背景:

为什么显式抛出NullPointerException而不是让它自然发生?

来源:互联网 

When reading JDK source code, I find it common that the author will check the parameters if they are null and then throw new NullPointerException() manually. Why do they do it? I think there's no need to do so since it will throw new NullPointerException() when it calls any method. (Here is some source code of HashMap, for instance :)When reading JDK source code, I find it common




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: