标签:
源代码
class InitializeBlockClass{
{
field =200;
}
public int field =100;
public InitializeBlockClass(int valve){
this.field=valve;
}
public InitializeBlockClass(){
}
}
public class Test {
public static void main(String[] args) {
InitializeBlockClass obj =new InitializeBlockClass();
System.out.println(obj.field);
obj =new InitializeBlockClass(300);
System.out.println(obj.field);
}
}
java字段的初始化默认为空。
标签:
原文地址:http://www.cnblogs.com/zxr-1996/p/4888391.html