Question: using java, and g iven the following class diagram, interfaces and classes that model various kinds of animals. What will be the errors in the
using java, and g
iven 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 2 interface Animal { int number of Legs(); 3 4 > Animal numberOfLegs(): int interface Mammal extends Animal ? interface Reptile extends Animal ( class Cat implements Mammal { public int number of Legs() { return; } 10 11 12 > Mammal > Reptile ) A 14 15 16 17 class Tiger extends Cat class Snake implements Reptile public int number of Logs() { return 0; Cat +numberOfLegs(): int Snake +numberOfLegs(): int 19 20 2 Tiger public class Animals public static void main(String args) { Animal animali, animal, animal3; Mammal mannall; Cat cat1; Snake snaken; Tiger tigert; List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
