Home  >  Article  >  Java  >  What are the commonly used data types in java

What are the commonly used data types in java

王林
王林Original
2019-12-02 16:29:064718browse

What are the commonly used data types in java

Data types in Java are divided into basic data types and reference data types.

Basic data types

1. 4 integer types

byte 1 byte -128——127

short 2 bytes -32,768 —— 32,767

int 4 bytes ——2,147,483,648 ——2,147,483,647 (more than 2 billion)

long 8 bytes -9,223,372,036,854,775,808——9,223,372,036854 ,775,807

Note: The number of bytes occupied by all data classes in Java has nothing to do with the platform, and Java does not have any unsigned types

Online learning video recommendations: java Online Tutorial

2. Two floating point types

float 4 bytes Single precision (significant digits 6 – 7 digits)

double 8 bytes Double precision (15 significant digits)

3. 1 Unicode encoded character unit

char 2 bytes The entire Unicode character set

4. 1 A Boolean type

boolean 1 bit True or false

Reference data type

1. Class class

2. Interface interface

3. Array array

Recommended related articles and tutorials: java introductory tutorial

The above is the detailed content of What are the commonly used 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