Basic Data Types in JAVA, JAVA Data Types

Source: Internet
Author: User

Basic Data Types in JAVA, JAVA Data Types

Byte: The smallest data type in java.1 byte/8 bits. -128 (2 ^ 7 )~ 127 (2 ^ 7-1), default value 0.

Short: short integer,2 bytes/16 bits, range:-32768 (-- 2 ^ 15 )~ 32767 (2 ^ 15-1), default value 0

Int: integer,4 bytes/32 bits, value range:-2147483648 (-2 ^ 31 )~ 2147483647 (2 ^ 31-1), default value 0

Long: long integer,8 bytes/64-bit,-2 ^ 63 (-2 ^ 63 )~ 2 ^ 63-1 (2 ^ 63-1), default: 0L

Float: float type,4 bytes/32 bits, used to store numbers with decimal points (the difference between double and float type is that the valid decimal point is only 6 ~ 7 digits). The default value is 0.

Double: double Floating Point Type,8 bytes/64-bit, default value 0

Char: character type, single character,2 bytes/16 bits, 0 ('\ u0000 ')~ 65535 ('\ uffff'), the default value is null

Boolean: boolean,1 byte, True or false (only two values, namely true and false). The default value is false.

 

 

Small capacity -------------------------------> large capacity

Byte, short, char <int <long <float <double

Byte <short

 

Byte, char, short, and char do not have implicit conversion, and only forced type conversion can be performed between them.

Related Article

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.