From a quote I read online:
One of Swift’s rules is that you must initialise all the properties of a class before initialising the superclass. This avoids issues that can arise if a super initialiser calls a method which is overridden resulting in inconsistent state.
So it seems like there is some programming paradigm behind this statement? Since I'm using Java and there is no such restriction in Java, I want to know how Java solves this problem.
In Java, the super constructor is run before the subclass constructor - the complete opposite of what happens in Swift. And There is nothing preventing you from calling an overridden method in the superclass constructor, but that doesn't mean you should do it. See this related question:
Basically, when you call an overridden method, there is a potential that you are accessing un-initialised fields, or just doesn't do what the superclass expects in general.
There are legitimate usages of this though:
In Swift, the superclass initialiser can call overridden methods without problems (as long as all the stored properties are initialised), because by that time, the properties of the whole class hierarchy is fully initialised.
There are tools like SonarQube that picks up problems like these, but otherwise the Java compiler doesn't do it. If you ask why, well, it's that whole "control vs safety" tradeoff - do you want more fine-grained control over your code, or more safety?