Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 numberOf Legs(); 2 4 interface Mammal extends Animal {} 6 > Animal numberOfLegs(): int interface Reptile extends Animal } 10 11 12 12 class Cat implements Mammal public int number of Logs() { return 4; ) > Mammal > Reptile A clans Tiger extends Cat ( 14 1 15 16 1 A 1 Cat clans Snake implements Reptilo { public int number of Legs() { return 0; ) Snake +numberOfLegs(): int IN 19 20 21 +numberOfLegs(): int Tiger public class Animals { public static void main(String args) { Animal animali, animal2, animal3; Mannal mammalt; Cat cat1 Snake snake; Tiger tigert; List 118t1, 11st2; 7 8 9 10 12 14 15 16 17 18 19 30 animalt - new Tiger(); snaket = new Animal(); anima12 - new Animal(); cat1 = new Tiger(); mammalt - new Snake(); tiger mammall; anima13 - cati; list1 new ArrayList(); 11st2- = new ArrayList(); 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

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions