Basic data types in Java

Source: Internet
Author: User

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

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

int: integer,4 byte /32 bit, value range 2147483648 ( -2^31) ~2147483647 (2^31-1), default value 0

Long: Length,8 bytes /64 bits, -2^63 ( -2^63) ~2^63-1 (2^63-1), default 0L

float: floating point,4 bytes /32 bits, for storing digits with a decimal point (the difference from a double is that the float type is valid only 6~7 bit), the default value is 0

Double: dual-precision floating-point,8-byte /64-bit, default value 0

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

Boolean: boolean,1 bytes , true or False (only two values, that is, true, false), default value False

Small capacity  -------------------------------> Large capacity   

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

byte << Short

There is no implicit conversion between Byte and Char, short and char, and only coercion type conversions can occur between them.

Basic data types in Java

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.