Middle
What is the order of calling constructors and initialization blocks considering the class hierarchy?
sobes.tech AI
Answer from AI
- Static blocks and static fields of the parent class (in order of declaration).
- Static blocks and static fields of the current class (in order of declaration).
- Non-static blocks and non-static fields of the parent class (in order of declaration).
- Constructor of the parent class.
- Non-static blocks and non-static fields of the current class (in order of declaration).
- Constructor of the current class.