I summarized the basic data types of Java.
type | Mold | Bit number | range | Description |
---|---|---|---|---|
Integer type | byte | 8 bits | -128 ~ 127 | |
short | 16 bit | -32768 ~ 32767 | ||
int | 32 bit | -2147483648 ~ 2147483647 | It is also possible to express it in other than decimal notation using the following prefix. ・ Binary number ⇒ 0b ~ ・ Eighth number ⇒ 0 ~ ・ Hexadecimal ⇒ 0x ~ |
|
long | 64-bit | -9223372036854775808 ~ 9223372036854775807 | Add "L" at the end when writing explicitly | |
Floating point type | float | 32 bit | ±1.40239846×10^-45~±3.40282347×10^38 | When explicitly stated, add "f" or "F" at the end |
double | 64-bit | ±4.94065645841246544×10^-324~±1.79769313486231570×10^308 | ||
Logical type | boolean | - | true or false | |
Character type | char | - | Can be written below -Unicode characters \ u0000- \ uFFFF ・ Integer value 0~65535 ・ Single quotation('')1 character enclosed in |
Recommended Posts