Java中
引用类型初始化后未赋值之前的值为null
基本数据类型
byte、short、int、long、boolean、char、float、double
这里要注意char类型初始化之后的默认值为空白(注意:不是空格)
import java.util.Arrays;
public class Test {
public static byte byte1;
public static short s;
public static int i;
public static long l;
public static char c;
public static boolean boolean1;
public static float f;
public static double d;
@org.junit.Test
public void test() throws Exception {
System.out.println("byte:" + byte1); //byte:0
System.out.println("short:" + s); //s:0
System.out.println("int:" + i); //i:0
System.out.println("long:" + l); //l:0
System.out.println("char:" + c); //char:
System.out.println("boolean:" + boolean1); //boolean:false
System.out.println("float:" + f); //l:0.0
System.out.println("double:" + d); //l:0.0
}
}