A reference variable can hold the reference of an object, but when we call any method by using reference variable then always call only those method which type of object we create.
Class Animal{
void eat(){ sop("animal class"); }
}
Class Dog extends Animal{
void eat(){ sop("dog class"); }
}
Class Cat extends Animal{
void … Read more