Java中8种基本数据类型及取值范围

Java中,一共有8种基本数据类型:

整型:byte,short,int,long。

浮点型:float,double。

字符型:char。

布尔型:boolean。

 

基本数据类型 字节长度 大小(位) 最小值 最大值 取值范围 包装类
byte 1字节 8bit -27 27-1 -128 ~ 127 Byte
short 2字节 16bit -215 215-1 -32768 ~ 32767 Short
int 4字节 32bit -231 231-1 -2147483648 ~ 2147483647 Integer
long 8字节 64bit -263 263-1 -9223372036854774808 ~ 9223372036854774807 Long
float 4字节 32bit IEEE754 IEEE754 - Float
double 8字节 64bit IEEE754 IEEE754 - Double
char 2字节 16bit Unicode 0 Unicode 216-1 - Character
boolean - - - - - Boolean
原文地址:https://www.cnblogs.com/hwpxxm/p/13098480.html