Till now we have worked on a single level hierarchy ( i.e. a subclass inheriting all the members of a superclass) . But we can create multiple levels of hierarchy (i.e. for example - class2 inheriting all the members of class1 and class3 inheriting all the members of class1 and class2).
Lets implement this on Eclipse IDE:
1.Create a superclass 'ClassOne' as shown below:
2. Create a subclass 'ClassTwo' for superclass 'ClassOne' as shown below:
6. Observe that the output is displayed in the console as shown below:
Click here to download this project containing 'ClassOne', 'ClassTwo', 'ClassThree' and 'MultiLevelHierarchy' class files used in this post (You can download this project and import into Eclipse IDE on your machine)
Please comment below to feedback or ask questions.
Using 'super' keyword in Multilevel hierarchy will be explained in the next post.