search
HomeJavaJavaBaseWhat are the basic data types in Java

What are the basic data types in Java

Nov 12, 2019 am 10:44 AM
javaWhichBasic data types

What are the basic data types in Java

1. Four integer types (byte, short, int, long)

byte: 8 bits, used to represent the smallest data unit , such as the data in the file, -128~127

short: 16 bits, -32768 ~ 32767

int: 32 bits, -2^31-1~2^31 (2.1 billion)

long: 64 bits

2. Two floating point types (float, double)

float: 32 bits, suffix F or f

double: 64 bits, the most commonly used, suffix D or d

3. A character type (char)

char: 16 bits, an integer Type, 1 character enclosed in single quotes (can be a Chinese character)

Note: It cannot be 0 characters.

Escape characters: \n Line feed \r Carriage return \t Tab character \" Double quotation marks \\ represents a \ Two characters char are connected with " " in the middle. The characters are first converted to int type internally, and then For addition operations, char is essentially a number! Binary, when displayed, is "processed" and displayed as characters.

4. A Boolean type (boolean)

true and false

5. Type conversion

char--> Automatic conversion: byte-->short-->int--> ;long-->float-->double                                                                                                                                                                                                           through Exceeding the value range

Recommended tutorial:

Java tutorial

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools