when a variable is inherited by a subclass.
then object of super class have its own copy of that variable likewise subclass also have its own copy of that variable.Therefore changes made to inherited variable either by subclass or superclass should not be visible to other class.
Then why in line 9 : joly is printed not Java since we are referring to the s of superclass.
It does not print Java because you are printing the variable s of an object whose state (meaning variable s) you are not changing through your program statement xi.s = "joly"; .
Please note that the above program creates 2 objects with the default value for the instance variable s as Java. Your program changes that default value for just one of those objects which is NOT being printed by your program.
It's not a static field, so each instance of the class has it's own copy of the variable (which explains the behaviour in the later listing). But it's not true to say that the subclass and superclass instance have separate copies. When you instantiate a subclass there is only one object. It inherits the variable from the superclass, but there's only one copy of it.