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.
Welcome to javaranch. We are a very friendly community and do not have many rules. However, there are a few guidelines that helps you get good answers. It will be nice if you can go through this on how to ask questions in the ranch. Specifically,
Originally posted by sujith delpachithra: Before constructing the B object it calls B's foo(). if it created B object it should call B's constructor first. i am too confused with the result. explain how the results are printed?
No-argument base-class constructors are implicitly called from the extending class' constructor.
It should make sense if you think of B's constructor as:
foo() isn't called before constructing B, but while.