Java Basic Data Type

Source: Internet
Author: User

1. Integer: byte, short, Int, long
2. Float Type: float, double
3. Character Type: Char
4. boolean: Boolean
Where:
Byte occupies 8 bits, or a byte. Because it is signed, the minimum value is-128, and the maximum value is + 127.
Short occupies 16 bits, two bytes. Minimum value: 2 ^ 15, maximum value: 2 ^ 15-1.
Int placeholder 32 bits, 4 bytes. Minimum value 2 ^ 31, maximum value 2 ^ 31-1
Long occupies 64 bits, 8 bytes. The minimum value is 2 ^ 63, and the maximum value is 2 ^ 63-1.
Float placeholder 32 bits, 4 bytes. Minimum Positive and non-zero value 2 ^-149, maximum positive and non-zero value (2-2 ^-23) · 2 ^ 127.
Double Zhangwei 64 bits, 8 bytes. The minimum positive and non-zero value is 2 ^-1074, and the maximum positive and non-zero value is (2-2 ^-52) · 2 ^ 1023

Char occupies 16 bits and 2 bytes. It is mainly used to support Unicode. Therefore, char in Java is a double byte, not a byte in C ++.
There are many online Boolean statements, but according to the bytecode content, if it is a single Boolean variable, int is used for storage. If it is a Boolean array, byte is used for storage.

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.