No need of implementing an Interface in Subclass if the Superclass has already implemented the interface. If Superclass has already implemented an interface, the subclass can inherit it without implementing the interface again.
Lets implement this on Eclipse IDE:
1. Create Interface 'Interface1' as shown below:
6. Observe that the output is displayed in the console as shown below:
Click here to download the project containing the 'Interface1', 'Superclass' and 'Subclass' 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.
1 comment:
Arun in the "HierarchyInterfaceDemo" class why did we create two objects for superclass as well as subclass.the motive could have been achieved by just creating an object for subclass as the subclass inherits the superclass properties.
Post a Comment