The first output of the main method of course is 'B'. The second is 'B' as well because A's method getTest has been overwritten by B. Is it anyhow possible to access the overwritten method and get the output 'A' from the object o?
I can't use Reflection for this at all because this will be transfered to an existing problem on the Android platform (but I posted it here because it isn't a pure Android problem).
Is there any way to realize that using 'Standard Java'?
It should be noted that the subclass CAN access the overwritten method by using the super keyword. Not sure how useful this is to the original questioner, but if you added a method "getTestSuper()" to your B class like so
Now this can be called from you main method
subject: Access overwritten method of parent class