Question: Given the following program segment. What is the output? * class Animal void eat () { System.out.print(eat what? ); } } class Cat extends Animal
Given the following program segment. What is the output? * class Animal void eat () { System.out.print("eat what? "); } } class Cat extends Animal void eat() { System.out.print("eat fish "); } } class Lion extends Animal void eat () { System.out.print("eat meat "); } 1 class Polytest! public static void main(string args[]) { Animal a - new Cat (); a.eat (); Lion b = new Lion(); b.eat(); 3 eat what? eat meat eat what? eat fish eat meat eat fish eat meat O eat meat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
