Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If you could explain how this works, that would be very helpful. Thanks! QUESTION 7 What is the result of the following two statements, assuming

image text in transcribed

If you could explain how this works, that would be very helpful. Thanks!

QUESTION 7 What is the result of the following two statements, assuming they reference the classes and declared variables below? Monitor m = wid; m.report(); public class Monitor public void report() { System.out.print("Nothing to report"); } } public class Widget extends Monitor { public void report() { System.out.print("Beware of spinning"); } } public class Gizmo extends Widget public class Thingy extends Gizmo { public void report () { System.out.print("Stay Back!"); } } // code fragment in some method from another class Widget wid = new Widget(); Gizmo giz-new Gizmo(); Thingy thing = new Thingyo; a. "Nothing to report" is printed to the console. b. "Beware of spinningNothing to report" is printed to the console. C. The program won't compile because the assignment is invalid. d. "Beware of spinning" is printed to the console

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