In the below code in Animal Class when I remove the ClimbTrees() Method why is it generating Error
public class Refr1
{
public static void main(String[] args)
{
Animal objChimp = new Chimp();
objChimp.ClimbTrees();
}
}
class Animal
{
void ClimbTrees()
{
System.out.println("I am Animal Which Climb Tree");
}
}
class Chimp extends Animal
{
void ClimbTrees()
{
System.out.println("I am Chimp Which Climb Tree");
}
}
If I Remove the ClimbTrees() in Animal Class its showing Below Error
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method ClimbTrees() is undefined for the type Animal