Looking back, Java restudying (v): Character type of Java basic data type

Source: Internet
Author: User

Java, as a strongly typed language, means that each variable will have a specific type, there are 8 basic types of Java, there are 4 types of integers (byte, short, int, long), two floating-point types (float, double), 1 character types (char) and a Boolean (Boolean), it is worth noting that although string strings are very common, it is not a basic type.

Three , character type (connected to the floating-point type)

 The char type is used to represent a single character, the Unicode encoding unit can be represented as 16 decimal, the range is a 16-bit Unicode character set from the char type in the \u0000~\uffff,java, and is used when using quotation marks in English, such as ' A ';

Unless you do need to operate on UTF-16 code units, it is not recommended to use the char type in your program, because the encoding mechanism used with the char type is far too old to satisfy the current application, although the type of char has been improved. However, in some cases, there are special problems that are known to occur when the database char type corresponds to a char type in Java, and in some special queries. It is recommended to use string to handle character types, in fact string in Java is based on a char array, which we will refer to later.

Four , Boolean type

  Feel the Boolean type there is nothing to say Ah, is true and false, even its packaging class are simple to die, do not tell what, there is a friend who has doubts to leave a message.

Looking back, Java restudying (v): Character type of Java basic data 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.