Java. Lang. nullpointerexception is generally reported for the following reasons:

Source: Internet
Author: User
Generally, java. Lang. nullpointerexception is reported for the following reasons:
· The string variable is not initialized;
· The object of the interface type is not initialized with a specific class, for example:
List lt; will report an error
List lT = new arraylist (); no error is reported
· When the value of an object is null, you are not sure whether it is null.
You can try CodeAdd a line of code before:

If (rb! = NULL );

........................ String type objects can be judged as follows if (rb! = NULL &&! "". Equals (RB ))
...... Of course, you can also make another judgment, whether it is not a Null String if (rb! = NULL &&! "". Equals (RB. Trim ()))

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.