我有以下这段代码:
public abstract class UCMService{
private String service;
protected DataMap dataMap = new DataMap();
protected class DataMap extends HashMap<String,String> {
private static final long serialVersionUID = 4014308857539190977L;
public DataMap(){
System.out.println("11111");
put("IdcService",service);
}
}
public UCMService(String service){
System.out.println("2222");
this.service = service;
}
}
现在在控制台中System.out.println
,DataMap
构造函数的构造函数在构造函数之前执行UCMService
。
我想知道为什么会这样。