boolean t;
char c;
byte b;
short s;
int i;
long l;
float f;
double d;
/**
1)布尔型 boolean 1个字节(8位) ture,false false
2)字节型 byte 1个字节(8位) -128~127 0
3)短整型 short 2个字节(16位) -2(的15次方)~2(的15次方)-1 0
4)整形 int 4个字节(32位) -2(的31次方)~2(的31次方)-1 0
5)长整形 long 8个字节(64位) -2(的63次方)~2(的63次方)-1 0
6)字符型 char 2个字节(16位) 0~2(的16次方)-1 '\u0000'
7)单精度浮点型 float 4个字节(32位) 1.4013E-45~3.4028E+38 0.0F
8)双精度浮点型 double 8个字节(64位) 4.9E-324~1.7977E+308 0.0D
*/ @Test public void defaultVal() { System.out.println("boolean " + t); System.out.println("char " + c); System.out.println("byte " + b); System.out.println("short " + s); System.out.println("int " + i); System.out.println("long " + l); System.out.println("float " + f); System.out.println("double " + d); }输出结果:boolean false
char
byte 0
short 0
int 0
long 0
float 0.0
double 0.0