简体   繁体   中英

In what occasions can we get a NullPointerException(“Name is null”); error?

Besides, the valueOf() method of Java's Enum class API, does anyone know, if any other Java API class throws that same exception, ie, NullPointerException("Name is null"); ?

There are no others:

$ pwd
/c/apps/java/jdk1.8.0/src

$ grep -r "\"Name is null"\" *
java/lang/Enum.java:            throw new NullPointerException("Name is null");

There are, of course, many other Java APIs (not the Oracle Java SDK) that could throw exactly the same exception...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM