Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Not sure what I'm doing wrong. Need help. Please answer the question by writing what is the output from the tester code shown in the

Not sure what I'm doing wrong. Need help.

Please answer the question by writing what is the output from the tester code shown in the bottom box

public class Animal (){

public String species;

public Animal(){

species =unknown

}

public void a1 (){

System.out.println ("Animal 1");

}

public void a2(){

System.out.println ("Animal 2");

}

public String toString(){

return "Animal String ";

}

}

public class Mammal extends Animal{

public int numFeet;

public Mammal (){

super();

numFeet=2;

}

public void a1 (){

System.out.println(Mammal a1);

}

public String toString(){

return " Mammal String ";

}

}

public class Human extends Mammal {

public boolean brain;

public Human (){

super();

brain=true;

}

public void a2(){

System.out.println("Human a2");

}

public class Tester{

public static void main (String []args){

Animal [ ] zoo= { new Mammal(), new Animal ( ), new Human() };

for ( int i=0; i< zoo.length; i++){

zoo[ i ].a1();

System.out.println(zoo[ i ]);

zoo[ i ].a2();

}

}

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_2

Step: 3

blur-text-image_3

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

What role does FinCEN play in defeating organized crime?

Answered: 1 week ago

Question

Understand why empowerment is so important in many frontline jobs.

Answered: 1 week ago