Question: Create an interface Printer with a default method printMessage ( ) . 2 . In the Printer interface, provide a default implementation that prints Printing

Create an interface Printer with a default method printMessage().
2. In the Printer interface, provide a default implementation that prints "Printing
message from Printer interface.".
3. Create a class InkjetPrinter that implements the Printer interface and overrides
printMessage() to print a different message.
4. Create a class LaserPrinter that does not override the printMessage() method.
5. Write a main() method to demonstrate how default methods work.

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 Programming Questions!