public interface Carnivore{
public void Eat(Herbivore h);
}
//Product
public class Wildebeest implements Herbivore{
}
public class Lion implements Carnivore{
public void Eat(Herbivore h){
System.out.println(“Lion eats “ +h.getName());
}
}
public class Bison implements Herbivore{
}
public class Wolf implements Carnivore{
public void Eat(Herbivore h){
System.out.println(“Wolf eats “ +h.getName());
}
}
//Client
public class AnimalWorld{