I have this following piece of code:
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;
}
}
Now in console the System.out.println
of DataMap
constructor is executing before the constructor of UCMService
.
I was wondering why it is happening.
See Question&Answers more detail:os