Question: this is Programming course A4. Given the following class diagram, interfaces and classes that model various kinds of animals. What will be the errors in

 this is Programming course A4. Given the following class diagram, interfaces

this is Programming course

A4. Given the following class diagram, interfaces and classes that model various kinds of animals. What will be the errors in the main method? For each error, indicate the line number of each incorrect statement and explain in one sentence why it is wrong. 1 interface Animal { int number of Legs(); 2 4 6 > Animal numberOfLegs(): int 8 9 5 interface Mammal extends Animal {} i interface Reptile extends Animal class Cat implements Mammal { public int numberOf Legs() { return 4; } } 10 12 > Mammal 13 14 > Reptile 4 4 16 17 class Tiger extends Cat class Snake implements Reptile { public int numberOf Legs() { return 0; 18 19 Cat +numberOfLegs(): int Snake +numberOfLegs(): int } 21 } Tiger 1 2 3 4 8 9 10 public class Animals { public static void main(String[] args) { Animal animali, animal2, animal3; Mamnal mammall; Cat cat1; Snake snaket; Tiger tigori; List listi, list2; animals = new Tiger(); snake1 = new Animal(); animal2 = new Animal(); cat1 new Tiger(); mammalt = new Snake(); tiger1 - mammall; animal3 = cat1; 11st1 = new ArrayList(); 11st2 - new ArrayList(); } } 12 14 16 17 18 19

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!