Joke Collection Website - Public benefit messages - What does java.lang.NullPointerException mean?

What does java.lang.NullPointerException mean?

java.lang.NullPointerException specifically means a null pointer exception. The most common problem is that there is no initialization.

In Java, the reasons for null pointer exceptions are generally as follows:?

1. String variables are not initialized;?

2. Interface type The object is not initialized with a specific class, for example:?

List lt; will report an error?

List lt = new ArrayList(); will no error be reported?

3. When the value of an object is empty, there is no judgment of being empty. You can try adding a line of code before the following code:?

if(rb!=null && rb!="")?

Change it to:?

< p>if(rb==null);?

if(rb!==null&&rb!="") or if(("").equals(rb))?

Extended information:

java.lang includes the basic Object class, Class class, String class, basic types of packaging classes, basic mathematics classes and other basic classes.

Class Math provides commonly used mathematical functions such as sine, cosine, and square root. Similarly, classes String and StringBuffer provide common string operations.

Classes ClassLoader, Process, Runtime, SecurityManager and System provide "system operations" such as dynamic loading of management classes, external process creation, host environment query (such as time) and security policy implementation.

Class Throwable contains objects that may be thrown by the throw statement (§14.16). Subclasses of Throwable represent errors and exceptions.