Question: Question 6 What concept is demonstrated by the Dog class extending the class? class Animal { void eat ( ) { System.out.printIn ( This

Question 6
What concept is demonstrated by the Dog class extending the class?
class Animal {
void eat(){
System.out.printIn("This animal eats food.");
}
}
class Dog extends Animal {
void bark(){
System.out.println("The dog barks.");
}
}
public class Main {
public static void main(String[] args){
Dog myDog = new Dog();
myDog.eat();
myDog.bark();
}
}
Inheritance
Encapsulation
Composition
Polymorphism
 Question 6 What concept is demonstrated by the Dog class extending

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!