Close
Close

what is the output of the following code segment?

   may

public class Carnivore {

...

public String favoriteFood()

{

return "meat";

} }

public class Cat extends Carnivore {

...

public String favoriteFood()

{

return "mice";

} }

// part of tester hile

Carnivore myPet = new Carnivore();

Carnivore yourPet = new Cat(); System.out.print(myPet.favoriteFood() + " " + yourPet.favoriteFood());


Answers

  •    seoexpertim

    Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. Taxi and Cab services



Ask Yours
Post Yours
Write your answer