标签:
除8种基本数据类型以外都是引用类型,实际上java中只有两种类型引用类型和原始类型(基本数据类型)....
String是引用类型变量默认初始值是null
String是对象,默认值是null
对象是引用数据类型
new String()和new String("")是申明一个空字串,不是null
布尔型的初始值是false,char型的初始值是空格
private int a; private byte b; private short c; private char d; private long e; private double f; private float g; private boolean h; private String string; public static void main(String[] args) { Inialization inialization = new Inialization(); System.out.println("int型初始值:"+inialization.a); System.out.println("byte型初始值:"+inialization.b); System.out.println("short型初始值:"+inialization.c); System.out.println("char型初始值:"+inialization.d); System.out.println("long型初始值:"+inialization.e); System.out.println("double型初始值:"+inialization.f); System.out.println("float型初始值:"+inialization.g); System.out.println("boolean型初始值:"+inialization.h); System.out.println("string型初始值:"+inialization.string); }
标签:
原文地址:http://www.cnblogs.com/lonely-buffoon/p/5569815.html