Java Basic data types

Source: Internet
Author: User

There are 8 basic data types in Java, such as the following:

    • Shaping: int, byte,short, long
    • Float type: float, double
    • Boolean Type: Boolean
    • Character type: Char

Table one basic data type

Type

Number of bytes

Number of digits

Range of values

Example

Byte

1

8

An integer of -27~27-1

-128,54,127

Short

2

16

An integer of -215~215-1

1348,6543

Int

4

32

An integer of -231~231-1

0,-1000,345678

Long

8

64

An integer of -263~263-1

987657897,-12

Float

4

32

An integer of -231~231

23.978,87f

Double

8

64

An integer of -263~263

2.0231,0.435d

Char

2

16

An integer of -215~215

400,a,z,x,-23

Boolean

1

8

True,false

True

Note: (1), Java does not have an unsigned type (unsigned).

(2), double quotation marks indicate a string, which is an object type of Java string, not a data type.

(3), a Boolean type has only two values, and the shaping value and the Boolean value cannot be converted to each other.

Java Basic data types

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.