This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Static initializer will be executed when the class is loaded, once you create instance of that class only instance initializer and constructors are executed, if you create multiple instance of class instance initializer and constructors are executed multiple times but static initializer will not.
Correct me if I am wrong When a class is loaded, first all static members are initialized, then all static blocks are executed in the order of declaration. But when the class is instatiated then if this class is derived from some superclass then the instance initalizer(s) of superclass(es), then constructor(s) of the superclass(es) then instace initializer of the class and finally constructor of the class is executed. And as Hetal said static blocks are not executed at the time of instatiation only at the time of loading
In other words....It is not that the value of si did not change. The static initialization block only gets executed one time. Since this is where you put the System.println call, it is only executed once.