The constructor executes in the following order:
- Calls the constructor of the superclass.
- Runs the instance initializer blocks in the order they were defined.
- Executes the rest of the body of the constructor.
I.e., both of your sysout statements execute just before the assignment n=10;
. That’s how it should be. See JLS §12.5.
1
solved What exaclty happens when a you call a constructor(new Class),do instance initializer blocks runs first? [closed]