Java Base character type

Source: Internet
Author: User

1. The literal of a char type can be an English letter, a character, or a Chinese character, and is included by a single quotation mark.

2. The Java bottom uses a 16-bit integer to handle the character type, which is the Unicode encoded value of a character.

Unicode:

1, Unicode encoding is a worldwide coding method.

2. The English part of Unicode encoding is compatible with ASCII code (ASCII denotes range 0~128), while English characters and numbers are encoded continuously.

3. Java, when processing data of type char, is processed by Unicode code at the bottom.

What is encoding?

The computer hardware system can only use 0 and 1 to represent the number, we have made the rule, a number can also represent a character.

void  out () {  for (int0; i++) {        System.  out. println ((char) i+":"+i);    }  }    


Output look at the results

Escape characters:

The escape character is "\", which can represent some special characters by escaping the character.

For example:

' \ n ' means carriage return

' \ t ' represents a tab-stop character, a tab indicates a 8-10-character jump to the right

' \ \ ' means \

' \ ' denotes single quotation marks

' \ ' means double quotation marks

Java Base character type

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.