الرجوع
تسجيل الدخول

Consider the following Java code:

class Animal {
    void eat() {
        System.out.println("This animal eats food.");
    }
}

class Dog extends Animal {
    void bark() {
        System.out.println("The dog barks.");
    }
}

What will happen if the following code is executed?

Dog myDog = new Dog();
myDog.eat();