1. Java.lang.NullPointerException "Null pointer exception"
There are several reasons for the general report java.lang.NullPointerException:
Usually, you refer to a new variable or the value is empty.
• The string variable is not initialized;
• An object of the interface type is not initialized with a specific class, such as:
List lt; Will error
List lt = new ArrayList (); You won't get an error.
• When the value of an object is empty, you are not judged to be empty.
You can try adding a line of code to the following code:
if (rb!=null && rb!= "")
Change to:
if (rb==null);
if (rb!==null&&rb!= "")
Objects of type string can be judged as follows
if (rb!==null&&! "". Equals (RB))
......
Of course, you can do more than one judgment, whether it is not an empty string
if (rb!==null&&! "". Equals (Rb.trim ()))
--java.lang.nullpointerexception of Java Exception resolution