Question: 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

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. 5 1 2 3 interface Animal { int number of Legs(); 3 5 G > Animal numberOfLegs(): int 7 8 9 10 11 12 interface Mammal extends Animal { } interface Reptile extends Animal {} class Cat implements Mammal { public int number of Legs() { return 4; } 1 > Mammal > Reptile 14 18 16 1 17 class Tiger extends Cat { } class Snake implements Reptile { public int number of Legs() { return 0; 18 Cat +numberOfLegs(): int Snake +numberOfLegs(): int 19 20 21 3 Tiger 2 3 4 6 7 8 9 10 11 12 13 1 public class Animals { public static void main(String[] args) { Animal animali, animal2, animal3; Mammal mammall; Cat cat1; Snake snake1; Tiger tiger1; List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
