Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(TCO 1, 3) What is printed out by the following code? public class Inherit { class Figure { void display( ) { System.out.println(Figure); } }
(TCO 1, 3) What is printed out by the following code? public class Inherit { class Figure { void display( ) { System.out.println("Figure"); } } class Rectangle extends Figure { void display( ) { System.out.println("Rectangle"); } } class Box extends Figure { void display( ) { System.out.println("Box"); } } Inherit( ) { Box b = new Box( ); Figure f = new Figure( ); Rectangle r = new Rectangle( ); b.display( ); b = f; b.display( ); b = r; f.display( ); } public static void main(String[ ] args) { new Inherit( ); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started