# 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gyansetu-java.gitbook.io/core-java/object-oriented-design-principles/is-a-relationship.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
