Java Data types

Source: Internet
Author: User

Java is a strongly typed language, which means that one type must be declared for each variable.

Java Integral type

Long 8 byte value range-922 3372 0368 5477 5808~922 3372 0368 5477 5807

int type 4 byte value range -2147483648~2147473647 (just over 2 billion)

The min=0x80000000 (8 after 7 0) max=0x7fffffff (7 after 7 F) is better remembered with 16 binary.

Short 2-byte value range -32768~32767

BYTE 1 byte value range -128~127

Long integer values have a suffix l (e.g., 0000 0000L). Hexadecimal values have a prefix of 0x (such as 0xCAFF). The octal number has a prefix of 0, for example, the octal number 010 is converted to decimal 8. Starting with the JAVA7 prefix 0b can represent a binary number, for example, the 0b1000 is converted to a decimal after 8. Also, starting with Java7, you can underline a number literal, such as 1_000_000 (or 0b1111_0100_0010_0100_0000), which represents 1 million. These underscores are only intended to make people more readable, and the Java compiler will remove these underscores.

Attention

Java No any unsigned type (unsigned).

Java floating point type

A double indicates that the numeric precision of this type is twice times the type of float (some call it a double-precision value).

A value of type float has a person suffix f (for example, 3.14F). Floating-point values that do not have a suffix (such as 3.14) default to a double type, and, of course, a suffix D (for example, 3.14D) after floating-point values.

Java Data types

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.