I want to implement an Abstract Java class. One of the abstract methods must be implemented by each child class, to ensure that that part of the code will be executed individually in each child class. Is there any other way to do it and thus avoid the "warning" that appears by calling an abstract method from the constructor of the main class?
public abstract class Listener {
protected Date checkTime = new Date();
protected TypeUpdate type = UNKNOW;
public Listener(){
super();
this.setTypeListener();
}
public void setTime(Date date) {
if (date != null) {
return;
}
this.checkTime = date;
}
/* Abstract methods */
public abstract void execute();
protected abstract void setTypeListener();
}
Thank you. ------------------------------ EDITED ----------
Ok, It's an error call an abstract method in constructor. So, what can I do to force inheriting classes to make a concrete constructor implementation (for example, initialize a member in one way or another?)