posted 24 years ago
that is becuase the method amethod() in class Base, has been overriden by the method amethod() in class RType.
so when we reach the line
Base b = new RType();
the constructor of the super class Base is called first,inside it, a call to the method amethod() is made, remember that this method has been overriden by the subclass, so it will call the overriden version of it, which will be inside the class RType.
so we get "RType.amethod" written to the output.
instead of the "Base.amethod()".
hope this helps
A Software life cycle can be greater than its Developer's