Java character escapes

Source: Internet
Author: User

Before the Java character escapes this piece to understand, here to reason oneself subjective superficial understanding

Here talk about character encoding is another problem and escaping no relationship

Do the following code analysis

System.out.println ("a". Length () + "B". Length ());

For the above code ["a". Length () + "B". Length ()] section

["] defaults to the compiler's ["], which identifies the string part of the compiler, ["a". Length () + "B". Length ()] After execution the output string is [2]

System.out.println ("A\". Length () +\ "B". Length ());

For the above code [a\]. Length () +\ "B" section

["] escapes as a string ["], which is used to identify the "string" part of a string (if the string can be executed like the code in the compiler, the effect would be similar), [a\. Length () +\ "b] executes after the string is [a]. Length () +" B ", The string output after the overall execution is [14]

Coding is another problem, is the machine recognition of characters, is the concrete manifestation of all abstract

ASCII encoding, Unicode encoding, and its implementation are UTF-8 encoded to implement characters in different binary ways, but in any case, all of these encodings are the same as the 0--127 notation (ASCII character implementations are common in all encodings)

Here is how Ruan greatly explained the problem of coding

Http://www.ruanyifeng.com/blog/2007/10/ascii_unicode_and_utf-8.html

Java character escapes

Related Article

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.