java基本数据类型

基本数据类型如下:

  byte:表示8位有符号二进制补码整数

  

//值的范围:-128(-2^7)-127(2^7-1),默认值:0 
byte a = 100;
byte b = -50;

  short:表示16位有符号二进制补码整数

//值范围:-2^15-2^15-1,默认值:0
short s = 10000;
short r = -20000

  int:表示32位有符号二进制补码整数

//值范围:-2^31-2^31-1,默认值:0
int a= 1000000;
int b = -200000;

  long:表示64位有符号二进制补码整数

//值范围:-2^63-2^63-1,默认值:0L
long a = 1000000L;
long b = -2000000L

  float:表示单精度32位IEEE 754浮点数

//默认值:0.0f,
float f1 = 234.5f

  double:表示双精度64位IEEE754浮点数

//默认值:0.0d
double d1 = 123.

  boolean:表示一个比特位的信息

//值范围:true/false,默认值:false

boolean one = true;

  char:表示单个16位Unicode字符

//值范围:u0000-uffff
char letterA = 'A'
原文地址:https://www.cnblogs.com/1218-mzc/p/12841560.html