> For the complete documentation index, see [llms.txt](https://gyansetu-java.gitbook.io/core-java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-java.gitbook.io/core-java/object-oriented-design-principles/is-a-relationship.md).

# IS-A relationship

![](/files/-LV1zJSd-mmKDAcwt6aq)

![](/files/-LV1zSj1pmxyZVRUEyuO)

![](/files/-LV1zYYRuvfzpKyghU2a)

To answer this question, refer to the preceding code, and you’ll notice that the interface Hunter is implemented only by class Carnivore. Class Cow doesn’t extend class Carnivore. So, Cow IS-A Hunter is incorrect. Similarly, you can refer to the preceding code to answer all the other options. Option 2 is incorrect because class Tiger doesn’t extend class Herbivore. Option 3 is correct because the interface Movable is implemented by class Animal, which is the base class of Herbivore, extended by class Cow. Option 4 is incorrect because you can’t traverse the hierarchy tree down to determine an IS-A relationship. Evaluate it like this: An Herbivore IS-A type of Animal with some additions or modifications because an Herbivore can modify (override) methods of class Animal and add new ones. But Animal IS-NOT-A Herbivore. Animal can also be a Carnivore.

![](/files/-LV1zuxOW3JKro2E0mAj)

![](/files/-LV2-F8yNqxLm2Gyy89I)

If you can traverse up, from a derived class or interface to a base class or interface, following the connecting arrows (lined or dashed), the derived entity shares an IS-A relationship with the base entity.

#### Problem :

![](/files/-LV2-QVrzVKRAdgu1h3e)

![](/files/-LV2-WDZfw-CYHU6cry_)

![](/files/-LV2-aFp9o1fkuOUJKaB)

![](/files/-LV2-m3InFoPuEgZZFAy)

![](/files/-LV2-t4pMurdCDVd8Cjj)

![](/files/-LV205Ui1yRXsivT0aea)
