Complete the code to define a small interface for printing only.
interface Printer {
void [1]();
}The method printDocument is the correct one for a Printer interface focused only on printing.
Complete the code to split a large interface into two smaller ones.
interface [1] { void printDocument(); } interface [2] { void scanDocument(); }
The Printer interface should have the printDocument method, and the Scanner interface should have the scanDocument method, following the Interface Segregation Principle.
Fix the error in the interface segregation by choosing the correct interface name for faxing.
interface [1] {
void faxDocument();
}The FaxMachine interface should contain the faxDocument method to keep interfaces focused and small.
Fill both blanks to define interfaces for printing and scanning separately.
interface [1] { void printDocument(); } interface [2] { void scanDocument(); }
Separating printing and scanning into Printer and Scanner interfaces follows the Interface Segregation Principle.
Fill all three blanks to define a multi-function device implementing separate interfaces.
class MultiFunctionDevice implements [1], [2], [3] { public void printDocument() { /* implementation */ } public void scanDocument() { /* implementation */ } public void faxDocument() { /* implementation */ } }
The class implements Printer, Scanner, and FaxMachine interfaces to follow the Interface Segregation Principle by using focused interfaces.