Hierarchical Inheritance You may be having the below question regarding hierarchical inheritance in java. Does Java supports hierarchical inheritance? Yes, It is quite possible to have hierarchical inheritance in java. What is hierarchical inheritance? As you can see in the above diagram that when a class has more than one child classes (sub classes) or in other words more than one child classes have the same parent class then such kind of inheritance is known as hierarchical. Let’s have a look at the below example program to understand it better – I’m using the above figure for implementing hierarchical inheritance in the below example- Class A { public void methodA () { System . out . println ( "method of Class A" ); } } Class B extends A { public void methodB () { System . out . println ( "method of Class B" ); } } Class C extends A { public void methodC () { System . out . println ( "...
IF YOU CAN DREAM IT. YOU CAN ACHIEVE IT.