0

I was taught that it is bad practice to call an overridable method in a constructor. What if I explicitly call the method of the parent class? Something like:

public class SuperClass{
    public void method(){
    }
}

public class SubClass extends SuperClass{
    Subclass(){
        super.method();
    }
}

Could still consistency issues be present? Is it a bad practice?

grecLon
  • 37
  • 6
  • There is no inherent problem with doing this. – Andy Turner Jan 29 '21 at 19:35
  • 3
    I disagree with @AndyTurner. There's no guarantee that the called method does not in turn call another method that might be overwritten and cause problems. – daniu Jan 29 '21 at 19:47

0 Answers0