Please explain how to extend two classes from different packages.
public class Animal extends Herbivores extends Omnivores { }
Please explain how to extend two classes from different packages.
public class Animal extends Herbivores extends Omnivores { }
Multiple Inheritance or Diamond Inheritance is a feature of object oriented concept, where a class can inherit properties of more than one parent class.
Java does not support that.
There are multiple resources over the net which tells you the problem that arises if you are allowed to do that.
Coming to your problem, it seems to me like a fault in Design.
Animal should be a parent type rather than a child type. Both Herbivores and Omnivores are animals. Whereas an animal doen't necessary have to be either. It can be a carnivore also.