Answered step by step
Verified Expert Solution
Link Copied!

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

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

How do rules guide verbal communication?

Answered: 1 week ago