When it comes to take a decision about the object, on which method has to be invoked , during cases like this, its always most specific one, given a priority. In our case B extends A. I.e B is more specific object when compared to A. So object of B is choosen. Its always the most specific one taken.
Also, we shall have a compiler error, if both A and B are peer classes. This is observable.