Char type of Java--escape character

Source: Internet
Author: User

ASCII code

In a computer, all data is stored and computed using binary numbers (because the computer represents 1 and 0, respectively, with high and low levels), for example, 52 letters (including uppercase) such as a, B, C, D, and 1, 2, and other commonly used symbols (example

such as *, #, @, etc.) are stored in the computer also to use a binary number to represent, and specifically with which binary numbers to indicate which symbol, everyone can contract their own set (this is called code), and if you want to communicate with each other without causing confusion, then we must

Using the same coding rules, the United States-related standardization organizations have introduced ASCII encoding, which uniformly stipulates which binary numbers are used to denote these common symbols.

The char type can accept a numeric range of values: 0-65536, the output will be converted to ASCII code.

Escape character

Give a special character assigned value to the char type

Assign a single quote ' to a char type

char c1 = ‘‘‘;

The above writing will be incorrect at compile time, the correct method should use the escape character, the slash in the Java language has the escape function, the correct wording is as follows:

char c1 = ‘\‘‘;

In my first program parsing, it contains the escape character, the tab \ t, and the output effect

Char type of Java--escape character

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.