Since the variable "i" is in both classes and you put a Derived class into a Base variable type,
java resolves the reference to i to be the i from the base. If, in main(), you had created the variable to be of type Derived, then "i" would resolve to Derived's value.
Think of it this way: if in Derived there was a variable "j", and you said:
Base b = new Derived();
b.j = 7;
The compile would fail because "j" is not a member of Base. Since you've created a variable of type Base, every variable and function reference must be valid for any Base variable.
Bruce.