Front end self taught Java Road (basic data type)

Time:2020-8-28

8 basic data types
Integer: byte short int long
Float double
Character type: char
Boolean: Boolean

byte
Byte type
1byte == 8bit 0The value range of 128 combinations is – 128 ~ 127 (- 7 power of 2 to 7 power of 2)
The first bold bit is used to indicate the positive and negative (0: positive, 1: negative) of the value

data type size Number of combinations Range
byte 8bit 256 -128 ~ 127
short 16bit 65526 -32768 ~ 32767
int 32bit The 32nd power of 2 -2147483648 ~ 2147483647
long 64bit The 64th power of 2

float
float
float == 32bit 0 000000000 0000000000000000000000
The first 0 is positive or negative, the second to tenth 0 is a decimal, and the last 22 digits are integers

char
character
char == 16bit
The char type is a single 16 bit Unicode character

boolean
Boolean type
Boolean = = 1bit has only two values: true and false
0 means false and 1 means true