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.
In his case, there are two instance variables named "a". The one in Test is initialized to 100 by the Test constructor, which executes first. The one in drived is initialized to 200 by the drived constructor, which executes second.
However, the second "a" is changed to 100 by drived's set() method, which is called from main() in Test with Test's "a" as an argument.
Remember that the hidden first line of the drived constructor is "super();", which calls the Test constructor.
Reason why u get 100 instead of 200 is that in case of variables,dynamic binding is not there.SO when u pass t.a.It sees t is defined as Test t=new Derived();.SO it picks value 100 belonging to Test not 200 belonging to Derived.