The short answer is that there's no polymorphism here. The two different "test" methods have different argument lists, so they are not polymorphic; they're said to be overloaded. It's up to the compiler to decide which of a set of overloaded methods is called, and the compiler looks only at the type of the variable on which the method is called. In contrast, the choice among polymorphic methods is made at runtime based on the actual type of the object.
In any event, here, the compiler sees only that the variable is of type "A", and it looks for a method "test" in "A" that it can call with an argment of type "B", and finds one, and calls it.
Now, if you change the argument type of B.test() to be "A", then you'd see polymorphic behavior. Try it!
// Because the test in myA should only accept (new A()'s) // Instances of the A class should be the only objects // that could enter the A.test(A a) method
But note that class B extends class A, and therefore, by definition, a B is an A. An instance of B can correctly be passed to either A.test(A) or B.test(B); an instance of A could only be passed to A.test(A). [ July 22, 2004: Message edited by: Ernest Friedman-Hill ]