I think the answer is -you have some static code within the class Q8, which is run when the class is loaded. However, the variable i inside this static block is local to this block and hence goes out of scope after the code block ends. It does not affect class variable i.