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.
The reason this occurs has to do with what is going on behind inheritance. I am going to refer to "test" as "testD" (Derived) and "test1" as "testS" (Super) to keep the meaning clearer about your classes.
When you instantiate testD, the first line executed (regardless of whether you type it or not is super();) inside of the constructor. So at the very beginning of the constructor of testD, i is =0. This is because before any assignments or code in testD can be executed, the super type must be created first. So, in testS, i is set to 10. BUT, since you have declared a variable type/name that is identical in the super class, the testS i variable is hidden. When show() is called inside of the testS constructor, no explicit call for testS i is made ... just simply the following:
System.out.println("i===" + i); //which i are you referring to? The compiler refers to the one that is not hidden, meaning testD's i, which at the moment = 0.
From there I think you can understand what is going on.
Here is an example that will show the correct output for each value.
There are a few other approaches to ensure the desired output but this is a easy concrete way to approach the problem.