I have written down codes something like below:abstract class ZmqSubscriber {   protected String zmqPort, zmqIp, zmpTopic;   public void start() {      init();      // connect to zeroMQ with initialized zmq port, ip, topic and receive data   }   abstract protected void init();}abstract class Collector extends ZmqSubscriber {   @Override   protected void init() {      super.zmqIp = this.zmqIp;      super.zmqPort = this.zmqPort;      super.zmqTopic = this.zmqTopic;   }   public void otherMethod() { //blablabla }}class Syncronizer extends ZmqSubscriber() {   //blablabla}class SensorCollector extends Collector {   private String zmqPort, zmqIp, zmpTopic;   @Override   protected void init() {      //this.zmqIp, this.zmpPort, this.zmqTopic will be already initialized at this moment using Spring framework's xml config file. In this way we can change ip and port at any time      super.zmqIp = this.zmqIp;      super.zmqPort = this.zmqPort;      super.zmqTopic = this.zmqTopic;      super.init();   }   // getters & setters for zmq port, ip, topic}class BeconCollector extends Collector {   // blablabla like SensorCollector}I definitely need three-level extends and this code is running well.But I think the way of initializing super class's (ZmqSubscriber) instance variable (zmqPort, zmqIp, zmqTopic) in sub class (SensorCollector) is not elegant, I can't say exactly why I think the part is not elegant, but I'm just Feeling it's not right when I looking at the code, maybe it is because of the duplicated code in init() method...Could anyone suggest more elegant architecture?
Initializing super class's variable from sub class
java