System.out.println("字节型最小值 Byte_Min: " + Byte.MIN_VALUE);
System.out.println("字节型最大值 Byte_Max: " + Byte.MAX_VALUE);
System.out.println("短型最小值 Short_Min: " + Short.MIN_VALUE);
System.out.println("短型最大值 Short_Max: " + Short.MAX_VALUE);
System.out.println("整型最小值 Int_Min: " + Integer.MIN_VALUE);
System.out.println("整型最大值 Int_Max: " + Integer.MAX_VALUE);
System.out.println("长型最小值 Long_Min: " + Long.MIN_VALUE);
System.out.println("长型最大值 Long_Max: " + Long.MAX_VALUE);
System.out.println("单精度最小值 Float_Min: " + Float.MIN_VALUE);
System.out.println("单精度最大值 Float_Max: " + Float.MAX_VALUE);
System.out.println("双精度型最小值 Double_Min: " + Double.MIN_VALUE);
System.out.println("双精度型最大值 Double_Max: " + Double.MAX_VALUE);
数据类型 | 取值范围(指数) | 取值范围(值) | 内存占用 |
byte | -2 ^ 7 ~ 2 ^ 7 - 1 | -128 ~ 127 | 1 字节 8 bit |
short | -2 ^ 15 ~ 2 ^ 15 - 1 | -32768 ~ 32767 | 2 字节 16 bit |
int | -2 ^ 31 ~ 2 ^ 31 - 1 | -2147483648 ~ -2147483647 | 4 字节 32 bit |
long | -2 ^ 63 ~ 2 ^ 63 - 1 | -9223372036854775808 ~ 9223372036854775807 | 8 字节 64 bit |
float | 1.4E-45 ~ 3.4028235E38 | 4 字节 32 bit | |
double | 4.9E-324 ~ 1.7976931348623157E308 | 8 字节 64 bit |