In the above line as we know that at runtime because of overriding chapter 8 test method will run.As s reference variable contains the reference of Chatpter8 object.so when this program will run x=20 will shadow the x=10 from superclass and we will get x=20 only.
Sorry about reposting of the code, but couldn't think of a better way.
Is x being shadowed? Both the x in Chapter8 and in Super are instance variables so don't they both have the same scope? From K&B 1.5 p.256; "Showding occurs when two variables with different scopes share the same name."