ExampleMany classes that are related to each other by inheritance.
- Each subclass inherit attributes and methods from superclass
- Subclasses also implement the methods in their own way
public interface Vegetarian{}
public class Animal{}
public class Deer extends Animal implements Vegetarian{}
Deer d = new Deer(); Animal a = d; Vegetarian v = d; Object o = d; //All the reference variables d, a, v, o refer to the same Deer object in the heap.



