albus dumbeldore wrote:which show() does c implement ??
From a pragmatic standpoint, what's the difference? If the signatures are the same, the implementing subclass will be an instance of both the superclass and interface (unless I'm misunderstanding something).
See java follows bottom to up approach but in this code you are overriding the same method show() in main. So it doesn't matter here which show() will be implemented here as it is defined in main class but according to java basics the show function of class B will be executed here as it is bottom to class A.
Jd Sethi wrote:according to java basics the show function of class B will be executed here as it is bottom to class A.
b.show() is declared as abstract, therefore it has no implementation, therefore there is no b.show() to execute. Same deal with a.show(). They both are just declarations and cannot be executed. A subtype must provide the implementation and in this case, that's c.show(), therefore the only executable show() is c.show().
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop