How does Java determine that string is null?

Source: Internet
Author: User

From: http://www.blogjava.net/hongzionline/archive/2007/09/27/148521.html

 

STR = NULL | Str. equals ("") ( attention sequence )
clarify another concept:
If STR = NULL, STR has not been defined. In this case, it cannot be left empty.
STR = "", indicating that STR is an empty string. The length is 0.
latency

string s;
...
If (S = NULL)
{< br> // NULL;
}< br> If (S. equals ("")
{< br> // null string;
}< br> If (S. length () = 0)
{< br> // null string;
}< BR >== is used to determine the object handle address. Note that S is not defined yet. In this case, it cannot be left empty.
equal is used to determine the content of the handle.
you can use this method to implement equal.
S. intern = "". intern

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.