Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. interface Animal 2 int number of legs(); 1 N 1 4 5 interface Mammal extends Animal interface Reptile extends Animal () clans Cat implements Mammal public int number of Legs ( return; ) ) 14 clans Tiger extenda Cat O 9 10 11 12 13 16 10 IN 19 20 class Bnake implements Reptile public int number of legs() return 0; 3 > Animal numberOfLegs(int > Mammal 11st1, 118t2; . 10 11 18 14 15 animalt - new Tiger(); snake1-new Animal(); animal2 - new Animal(); cat1 - new Tiger); mannalt - Dev Snake(); tiger1 Bannall: animal3cati 11sti = new ArrayList ; 11st2 -new ArrayList Reptile(); 11 IN 19 200 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started