short 2 byte 2*8bit
char 2 byte 2*8bit
int 32 byte 4*8bit
long 64 byte 8*8bit
float 32 byte 4*8bit 单精度 4字节
double 64 byte 8*8bit 双精度 8字节
byte,short,int,long都属于整形数据类型.
而float和double属于浮点型,而浮点型默认的是double,这就意味着你声明float t = 1.0是不会通过编译的,因为1.0在java中应该是double型的,所以你必须这样声明,float t = 1.0F;或者干脆float t =(float)1.0;
如果是Long对象的话,不能==。
应该用equals()或者compareTo()或者intValue() 或者longValue() 。
如果是基本型的long的话,就可以用==。
Long l6=16L;
Long l7=new Long(16L);
Long l8=new Long(16L);
System.out.println(l6==l7);//false
System.out.println(l8==l7);//false