Home  >  Article  >  Java  >  What are the basic data types in java

What are the basic data types in java

coldplay.xixi
coldplay.xixiOriginal
2020-08-21 10:47:225302browse

The basic data types of Java are: 1. Boolean type; 2. Byte type; 3. Short integer type; 4. Integer type int; 5. Long integer type long; 6. Single precision Floating point type float; 7. Double precision floating point type double; 8. Character type char.

What are the basic data types in java

[Related learning recommendations: java basic tutorial]

The basic data types of java are:

1. Boolean type (boolean)

Value range: True or False

2. Byte type (byte)

Value range: 0 - 255

3. Short integer type (short)

Value range: -32,768 ~ 32767

4. Integer type (int)

Value range: -2,147,483,648 ~ 2,147,483,647

5. Long integer type (long)

Value range: -9223372036854775808~9223372036854775807

6. Single precision floating point type (float)

Negative range:

-3.402823E38 ~ -1.401298E-45

Positive range:

1.401298E-45 ~ 3.402823E38

7. Double precision floating point type (double)

Negative number range:

-1.797,693,134,862,32E308 ~

-4.940,656,458,412,47E-324

Positive range:

4.940,656,458,412,47E-324 ~

1.797,693,134,862,32E308

8, character type (char)

Value range: '\u0000'~'\ufff'

What are the basic data types in java

Extended information

Required for arrays of any data type 20 bytes of memory space, plus 4 bytes for each array dimension, plus the space occupied by the data itself. The memory space occupied by the data can be calculated by multiplying the number of data elements by the size of each element.

For example, the data in a one-dimensional array composed of four 2-byte Integer data elements occupies 8 bytes. These 8 bytes plus an additional 24 bytes bring the total memory space required for this array to 32 bytes.

Related learning recommendations: Programming video

The above is the detailed content of What are the basic data types in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn