If I implement an interface, would it be called a java interface inheritance?

537    Asked by AndrewJenkins in Java , Asked on Oct 6, 2022

 If my class implements an interface then can I say that I'm following inheritance? I know that when a class extends another class then it's inheritance.

Answered by Ankesh Kumar

Regarding the java interface inheritance - Inheritance means writing a new subclass for a superclass. Writing a new class against an interface is implementing that interface. (And writing a new interface based on an old one is extending that interface.) The only correct term that applies to all three possibilities is subtyping. Not every subtype is a subclass.



Your Answer

Interviews

Parent Categories