java--Basic data Types detailed

Source: Internet
Author: User

In Java, you can divide data types into two kinds of numeric types and Boolean types:

Integral type

int an int integer that occupies 32 bits in memory, and the range of tables is:-2147483648 (-) to 2147483647 (-1).

"Long a long integer in memory occupies 64 bits, the range of tables is:-9223372036854775808 (-) to 9223375036854775807 (-1)

"Bype a Bype-type integer that occupies 8 bits in memory, and the range of tables is:-128 (-) to 127 (-1)

Short a short integer occupies 16 bits in memory, and the range of tables is:-32768 (-) to 32767 (-1).

The Java integer constant is the int type by default, and in addition, there are two situations that must be noted:

If you assign a small integer constant (in the range of Bype or short tables) to a bype or short variable, the system automatically treats the integer constant as a bype or short type.

If you use a huge integer constant (beyond the range of table numbers of type int), Java does not automatically treat this integer constant as a long type. If you want the system to treat an integer constant as a long type, you should add L or L as the suffix after the integer constant. L is usually recommended because L is easy to mix with 1.

Still in the middle of the revision ...

java--Basic data Types detailed

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.