Question: Q 1 . What is printed by the following code? Consider the polymorphic invocation. Verify your answer by writing the code in your IDE (
Q What is printed by the following code? Consider the polymorphic invocation. Verify your answer by writing
the code in your IDE eg Eclipse and observing the output.
public class Practice
Practice
Figure new Figure ;
Rectangle new Rectangle;
Box new Box;
fdisplay;
;
fdisplay;
;
fdisplay;
public static void mainString args
new Practice;
class Figure
void displaySystemout.printlnFigure;
class Rectangle extends Figure
void displaySystemout.printlnRectangle;
class Box
void displaySystemout.printlnBox;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
