为什么没有赋值的时候,float型变量默认为零?而String类变量为null?
public class HelloWorld {
float a;
public static void main(String[] args) {
HelloWorld helloword=new HelloWorld();
System.out.println("a:"+helloword.a);
}
}
求解释为什么是0.0?不是没有初始化吗?public class HelloWorld {
float a;
public static void main(String[] args) {
HelloWorld helloword=new HelloWorld();
System.out.println("a:"+helloword.a);
}
}
求解释为什么是0.0?不是没有初始化吗?2015-12-22
举报