Question: public class DimmableFloorLamp extends FloorLamp implements Dimmable { public void turnOff() { System.out.print(Dimmable Off: ); } public void turnOn(){ System.out.print(Dimmable On: ); } publicvoidsetTo(intvalue){System.out.print(DimmableDimVal:+value+:); }

 public class DimmableFloorLamp extends FloorLamp implements Dimmable \{ public void turnOff()

public class DimmableFloorLamp extends FloorLamp implements Dimmable \{ public void turnOff() \{ System.out.print("Dimmable Off: "); \} public void turnOn()\{ System.out.print("Dimmable On: "); \} publicvoidsetTo(intvalue){System.out.print("DimmableDimVal:"+value+":"); \} Consider this instantiation code: Room r= new Room(); OnOffable p= new FloorLamp (); r. setLamp ((FloorLamp) p); r.turnLighton (); r.turnLightoff(); Will it compile, and if yes, what will it print? a. Runtime Error b. Lamp On: Dimmable Off: c. Lamp On: Floor Off: d. Dimmable On: Dimmable Off: e. Dimmable On: Floor Off

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!