My question is why a non-abstract Parent Class can be extended by an abstract Child Class ?
Take a look at the following code:-
This code compiles fine and when it is executed it gives the following output:-
Inside method1() AbstractTest
Now in the class AbstractTest if the following three lines are commented :
then the code gives compilation error:
AbstractTest is not abstract and does not override abstract method method1() in Child
In summary, a non-abstract parent class (Parent) can be extended by an abstract child class (Child). Now this means that all the methods decared in the parent class (method1()) get replaced by the corresponding method signatures in the abstract child class. Is there any specific reason why this is allowed in JAVA ?