When we run new Subclass() then then sections of the code are executed in the following sequence
- In Superclass, all static variables are initialized and all static initialization blocks are run, in order in which they appear in the file.
- In Subclass, all static variables are initialized and static initialization blocks are run, in the order in which they appear in the file.
- In Superclass, all instance variables are initialized and all object initialization blocks are run, in the order in which they appear in the file.
- In Superclass, the (relevant) constructor is run.
- In Subclass, all instance variables are initialized and all object initialization blocks are run, in the order in which they appear in the file.
- In Subclass, the (relevant) constructor is run.