Say class A is super class of B which is superclass of C. A and B are Abstract classes(I've kept them so as no object of actual class A or B can exist, in other words actual class of an object can only be C). I've an Abstract method in A which should not be implemented in B as no such object of actual class B can exist. Therefore, it should be implemented only in C and kept abstract in both A and B.
As far as I know subclasses have to implement abstract methods of superclass in Java. Is there a way out? Or do I need to just keep an empty implementation in B?
An abstract
class can leave abstract
methods of its superclass unimplemented. So if B
is also abstract
, it can leave this method unimplemented and have C
, the first concrete class in the hierarchy, implement it.