Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

3. Who would the members be?

Answered: 1 week ago